Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| /* Better styles for embedding GitHub Gists */ | |
| .gist{font-size:13px;line-height:18px;margin-bottom:20px;width:100%} | |
| .gist pre{font-family:Menlo,Monaco,'Bitstream Vera Sans Mono','Courier New',monospace !important} | |
| .gist-meta{font-family:Helvetica,Arial,sans-serif;font-size:13px !important} | |
| .gist-meta a{color:#26a !important;text-decoration:none} | |
| .gist-meta a:hover{color:#0e4071 !important} |
| <?php | |
| class LazyServiceController | |
| { | |
| private $container; | |
| private $serviceName; | |
| public function __construct(\Pimple $container, $serviceName) | |
| { | |
| $this->container = $container; |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| $sites = array( | |
| 'sitename.com' => 'sitename.com', | |
| // the first sitename.com in the file, refers to the url content in the browser's window, | |
| //you may/probably should replace this with a FQDN. | |
| // the second sitename.com appearing after '=>' is the directory name inside sites/ where | |
| //the site files are stored. | |
| ); |
| <?php | |
| namespace Reizwerk\TestSuiteBundle\Test; | |
| use Doctrine\ODM\MongoDB\DocumentManager; | |
| use Doctrine\Common\DataFixtures\Executor\MongoDBExecutor; | |
| use Doctrine\Common\DataFixtures\Purger\MongoDBPurger; | |
| use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader; | |
| use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
| /** |
| #!/usr/bin/env php | |
| <?php | |
| /** | |
| * .git/hooks/pre-commit | |
| * | |
| * This pre-commit hooks will check for PHP errors (lint), and make sure the | |
| * code is PSR-2 compliant. | |
| * | |
| * Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer) | |
| */ |
| apt-get update | |
| aptitude install -y apache2 libonig2 libqdbm14 libxml2 apache2-mpm-prefork ucf libicu44 mysql-server libjpeg62 libpng12-0 libt1-5 libxpm4 git-core autoconf automake libssl-dev libtool shtool make | |
| service mysql stop | |
| sed -i 's/\/var\/lib\/mysql/\/dev\/shm\/mysql/g' /etc/mysql/my.cnf | |
| sed -i '/en_US/a skip_innodb' /etc/mysql/my.cnf | |
| mysql_install_db | |
| service mysql start | |
| echo ServerName localhost > /etc/apache2/httpd.conf | |
| cd /etc/apache2/mods-enabled | |
| ln -s ../mods-available/rewrite.load |
| <?php | |
| namespace Demo { | |
| require __DIR__."/vendor/autoload.php"; | |
| use Nocarrier\Hal; | |
| class Resource extends Hal {} | |
| class ResourceResponse |
| <?php | |
| namespace Acme\UserBundle\Listener; | |
| use Symfony\Component\Form\FormEvent; | |
| use Symfony\Component\Form\FormEvents; | |
| use Symfony\Component\Form\FormFactoryInterface; | |
| use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
| /** |
| <?php | |
| function mycommands_drush_command() { | |
| $items = array(); | |
| $items['one-command'] = array( | |
| 'description' => 'A command requiring two arguments.', | |
| // Declare required arguments. | |
| 'arguments' => array( | |
| 'arg1' => 'arg1 description', | |
| 'arg2' => 'arg2 description', |