how composer saved php

35
HOW COMPOSER SAVED PHP

Upload: ryan-kilfedder

Post on 13-Apr-2017

131 views

Category:

Software


1 download

TRANSCRIPT

Page 1: How composer saved PHP

HOW COMPOSER SAVED PHP

Page 2: 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

Page 3: How composer saved PHP

DEPENDENCY MANAGEMENT

?

Page 4: How composer saved PHP

DEPENDENCY MANAGEMENT IN

PHP IN 2012A confused mixture

Page 5: How composer saved PHP

DEPENDENCY MANAGEMENT

➤ PEAR

➤ phpclasses.org

Page 6: How composer saved PHP

DEPENDENCY MANAGEMENT

➤ PEAR

➤ phpclasses.org

Page 7: How composer saved PHP

DEPENDENCY MANAGEMENT

➤ PEAR

➤ phpclasses.org

➤ Framework Specific Dependency Management

➤ CodeIgniter - Sparks

➤ FuelPHP - Cells

➤ Laravel - Bundles

➤ Cake - The Bakery

➤ ZF2 - Modules

Page 8: How composer saved PHP

INTEROPERABILITY +

STANDARDS SUUUUURRRREEE

Page 9: How composer saved PHP

CODING STANDARDS

$variablenamelikeso

$variableNameLikeSo

$variable_name_like_so

Page 10: How composer saved PHP

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?

Page 11: How composer saved PHP
Page 12: How composer saved PHP

“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

Page 13: How composer saved PHP

“The PHP community needs to get together behind a new solution and the framework developers need to lead the charge.

- Phil Sturgeon, 2012

Page 14: How composer saved PHP
Page 15: How composer saved PHP

ENTER

Page 16: How composer saved PHP

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

Page 17: How composer saved PHP

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.*"

},

Page 18: How composer saved PHP

ADDING A NEW PACKAGE TO MY PROJECT

Page 19: How composer saved PHP

ADDING A NEW LIBRARY

COMPOSER.JSON

COMPOSER.LOCK

Page 20: How composer saved PHP

ENTER

Page 21: How composer saved PHP

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

Page 22: How composer saved PHP

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

Page 23: How composer saved PHP

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

Page 24: How composer saved PHP

ENTER

Page 25: How composer saved PHP

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

Page 26: How composer saved PHP
Page 27: How composer saved PHP

NOW?What’s the current state of PHP?

Page 28: How composer saved PHP

COMPOSER INFLUENCE

Page 29: How composer saved PHP

COMPOSER INFLUENCE

johnpbloch/wordpress // roots.io // wpackagist.org

Page 30: How composer saved PHP

ENTER

Page 31: How composer saved PHP

THE PHP LEAGUE

➤ Packages for everyone

➤ Which are PHP-FIG compliant

➤ PHP: The right way

➤ “Everyone first”

➤ Adapters for specific frameworks

➤ Flysystem, wow!

Page 32: How composer saved PHP

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

Page 33: How composer saved PHP

ENTER YOU?

Page 34: How composer saved PHP

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

Page 35: How composer saved PHP

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

[email protected]