how composer saved php
TRANSCRIPT
HOW COMPOSER SAVED PHP
OBLIGATORY “ABOUT ME” SLIDE
➤ Worked as a web developer since 2006 ➤ Have used several in-house and OS
frameworks ➤ Involved with phpBelfast ➤ Currently work for The Tomorrow Lab ➤ @ryankilf
DEPENDENCY MANAGEMENT
?
DEPENDENCY MANAGEMENT IN
PHP IN 2012A confused mixture
DEPENDENCY MANAGEMENT
➤ PEAR
➤ phpclasses.org
DEPENDENCY MANAGEMENT
➤ PEAR
➤ phpclasses.org
DEPENDENCY MANAGEMENT
➤ PEAR
➤ phpclasses.org
➤ Framework Specific Dependency Management
➤ CodeIgniter - Sparks
➤ FuelPHP - Cells
➤ Laravel - Bundles
➤ Cake - The Bakery
➤ ZF2 - Modules
INTEROPERABILITY +
STANDARDS SUUUUURRRREEE
CODING STANDARDS
$variablenamelikeso
$variableNameLikeSo
$variable_name_like_so
SUMMARY - SILOS
➤ Different Coding Standards
➤ Different dependency tools
➤ How to write something for both, say, Laravel & FuelPHP?
➤ Where do you put it?
➤ Are you creating two entirely separate repos?
“Originally used for tracking visits to his online resume, he [Rasmus Lerdorf] named the suite of scripts "Personal Home Page Tools," more frequently referenced as "PHP Tools."
- php.net history page
“The PHP community needs to get together behind a new solution and the framework developers need to lead the charge.
- Phil Sturgeon, 2012
ENTER
PROBLEMS COMPOSER SOLVES
➤ Installation per site
➤ Not curated
➤ But packagist.org helps ensure quality
➤ Tests part of composer.json
➤ PSR-0 Compliant Autoloading solution
➤ Now PSR-4
➤ Don’t have to commit every file in some library
TYPICAL COMPOSER FILE (SECTION THEREOF)
"require": {
"php": ">=7.0.1",
"doctrine/dbal": "^2.5",
"fzaninotto/faker": "^1.6",
"jeroennoten/laravel-adminlte": "^1.17",
"laravel/framework": "5.3.*"
},
ADDING A NEW PACKAGE TO MY PROJECT
ADDING A NEW LIBRARY
COMPOSER.JSON
COMPOSER.LOCK
ENTER
PROBLEMS SYMFONY COMPONENTS SOLVE
➤ Great Libraries
➤ Used in lots of frameworks
➤ interoperability
➤ N.B. Symfony not a monolith, but a bunch of bits
➤ But I can take those bits and make what I want
PROJECTS USING SYMFONY COMPONENTShttp://symfony.com/projects
Drupal phpBB Laravel Symfony Full Stack eZ Publish Community Joomla! Composer Magento Piwik Silex
Assetic Goutte Sami Sismo PHPUnit OroCRM OroPlatform Doctrine Behat Sylius
Sonata Project Zikula Symfony CMF Akeneo PIM Shopware Propel Mautic Codeception
PROJECTS USING SYMFONY COMPONENTShttp://symfony.com/projects
TYPO3 Thelia Kunstmaan Bundles Sculpin Flow phpspec phpDocumentor Guzzle Bolt Pagekit Vespolina Easybook Fork CMS phpMyFAQ PPI Framework
Proem Framework Sulu init CMS Carew RedKite CMS Ladybug Phinx Elcodi Spress phpRedExpert Roadiz Mothership BackBee concrete5 Sonata e-commerce
Drupal Console Grav WellCommerce Contao Aimeos e-commerce components PHP Depend bowerphp freepost Morfeu Pimcore CSBill eccube
ENTER
PROBLEMS PHP-FIG SOLVES
➤ Standards
➤ for everyone
➤ A whole PHP vision
➤ a PHP-first community
➤ Not just a community for every framework
➤ They don’t write code
➤ PSR-0 - most important
NOW?What’s the current state of PHP?
COMPOSER INFLUENCE
COMPOSER INFLUENCE
johnpbloch/wordpress // roots.io // wpackagist.org
ENTER
THE PHP LEAGUE
➤ Packages for everyone
➤ Which are PHP-FIG compliant
➤ PHP: The right way
➤ “Everyone first”
➤ Adapters for specific frameworks
➤ Flysystem, wow!
PHPBELFAST FRAMEWORK
➤ Now viable to make entire applications out of “Stuff” on packagist
➤ Not convinced that it’s the right thing to do
➤ But, still great that it’s viable
➤ @phpbelfast
ENTER YOU?
LESSONS FOR OPEN SOURCE
➤ Write code for the widest possible number of users
➤ Documentation matters
➤ Make the easiest solution the best solution
➤ Lots of small packages > few big ones
➤ community matters
FURTHER READING
➤ benramsey.com/blog/2013/11/the-fall-of-pear-and-the-rise-of-composer
➤ philsturgeon.uk/php/2012/03/06/packages-the-way-forward-for-php
➤ symfony.com/projects
➤ roots.io
GET IN TOUCH
➤ @ryankilf // @thetomorrowlab