This talk takes a practical look at getting started with Composer in your project, regardless of what PHP technology you're using. We also look at why sharing in PHP used to suck, and how awesome our world has become!
• KnpLabs US - Symfony consulting, training, Kumbaya • Writer for KnpUniversity.com screencasts • Husband of the much more talented @leannapelham knplabs.com github.com/weaverryan @weaverryan Wednesday, November 20, 13
autoloader doesn’t know where ZF1 classes live. The Zf1 autoloader doesn’t know where symfony1 classes live • Each library has its own autoloader that you must discover, configure and use Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
a directory that contains anything (usually PHP classes) • Every package has a unique name • The mega-repository for packages is http://packagist.org Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
package name & version 3. Create composer.json configuration 4. Download via composer install 5. Require autoload.php... then go crazy! Wednesday, November 20, 13
composer.lock • update: ignores composer.lock and re- parses composer.json, updating packages to the latest version specified there and then updates composer.lock Wednesday, November 20, 13
your own classes: http:// bit.ly/I2JZoP C) Stability Flags: http://bit.ly/18kDKq1 D) Optimizing the Autoloader: http:// bit.ly/composer-dump-autoload Wednesday, November 20, 13
forms $driver = new \Behat\Mink\Driver\SahiDriver('firefox'); $session->visit('http://my_project.dev/some_page.php'); $page = $session->getPage(); $anchor = $page->find('css', '.something'); $anchor->click(); // get the content of the new page echo $page->getContent(); Wednesday, November 20, 13
use Monolog\Handler\StreamHandler; use Monolog\Handler\FirePHPHandler; // Create the logger $logger = new Logger('my_logger'); $logger->pushHandler(new StreamHandler( __DIR__.'/my_app.log' )); $logger->pushHandler(new FirePHPHandler()); $logger->addInfo('My logger is now ready'); Wednesday, November 20, 13