Skip to content

Instantly share code, notes, and snippets.

Found an example there is a thing in laravel called FormRequest. Sometimes, I need extra validation. So I need to use some service there somehow. What options I have

  1. facade
  2. service locator via app() global function
  3. I also have instance of container there via $this->container

which one is the best here? I suppose instance of container

I can't do constructor injection. Why? Because for me, it seams that there are too many arguments on the __construct method

@mattsches
mattsches / layered.inc.php
Last active December 20, 2015 21:48 — forked from onli/layered.inc.php
Added charset to connection adapter
<?php
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Select;
use Zend\Db\Adapter\Adapter;
$result = null;
/**
* Tells the DB Layer to start a DB transaction.
*
* @access public
@mattsches
mattsches / test.php
Created February 22, 2012 12:05 — forked from rodneyrehm/test.php
PHPGangsta: Doppelte Array-Einträge entfernen
<?php
if (extension_loaded('xdebug')) {
echo "WARNING: xdebug is enabled\n";
}
function _count()
{
$array = array(1, 5, 8, 'Michael', 5, 4, 9, 'Martin', 18, 12, 'Michael', 4, 12);