SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Jordi Boggiano
@seldaek
http://nelm.io/

Dependency Management
with Composer
About Me
              Belgian living in Zürich, Switzerland
              Building the internet for 10 years
               http://seld.be
              Symfony2, Composer and other OSS contributions
               http://github.com/Seldaek
              Working at Nelmio
               http://nelm.io
               Symfony2 & frontend performance consulting




Jordi Boggiano                                                 Company nelm.io
Twitter @seldaek                                                   Blog seld.be
Jordi Boggiano     Company nelm.io
Twitter @seldaek       Blog seld.be
Managing
                   Packages vs Dependencies




Jordi Boggiano                                Company nelm.io
Twitter @seldaek                                  Blog seld.be
Package Management in PHP




Jordi Boggiano                                 Company nelm.io
Twitter @seldaek                                   Blog seld.be
The Composer Ecosystem
                        github.com/composer




Jordi Boggiano                                Company nelm.io
Twitter @seldaek                                  Blog seld.be
The Composer Ecosystem
              Composer - CLI Tool
                   Easy to use
                   Installs deps per-project
                   Flexible and embeddable




Jordi Boggiano                                 Company nelm.io
Twitter @seldaek                                   Blog seld.be
The Composer Ecosystem
              Packagist - Package Repository
                   Aggregates PHP libraries
                   Open to all OSS projects
                   Feeds on VCS repositories




Jordi Boggiano                                 Company nelm.io
Twitter @seldaek                                   Blog seld.be
Early adopters are loving it




Jordi Boggiano                                    Company nelm.io
Twitter @seldaek                                      Blog seld.be
The Composer Ecosystem
              Satis - Micro Repository
                   Minimalistic
                   Useful for closed code




Jordi Boggiano                               Company nelm.io
Twitter @seldaek                                 Blog seld.be
Usage Instructions
Using a Composed Project
               git clone https://github.com/igorw/trashbin

               Cloning into trashbin...

               cd trashbin/
               curl -s http://getcomposer.org/installer | php

               All settings correct for using Composer
               Composer successfully installed to: /home/bob/trashbin/composer.phar
               Use it: php composer.phar




Jordi Boggiano                                                                    Company nelm.io
Twitter @seldaek                                                                      Blog seld.be
Using a Composed Project
               php composer.phar install

               Installing from lock file
                 - Package symfony/class-loader (2.1.0-dev)
                   Downloading
                   Unpacking archive
                   Cleaning up
               [...]
                   - Package predis/predis (dev-master)
                     Downloading
                     Unpacking archive
                     Cleaning up
                   - Package twig/twig (1.6.0)
                     Downloading
                     Unpacking archive
                     Cleaning up
               Generating autoload files




Jordi Boggiano                                                Company nelm.io
Twitter @seldaek                                                  Blog seld.be
Using a Composed Project
              01 vendor/
              02     .composer/
              03     bin/
              04     pimple/
              05         pimple/
              06     predis/
              07         predis/
              08         service-provider/
              09     silex/
              10         silex/
              11     symfony/
              12         browser-kit/
              13         class-loader/
              14         css-selector/
              15         dom-crawler/
              16         event-dispatcher/
              17         finder/
              18         http-foundation/
              19         http-kernel/
              20         routing/
              21     twig/
              22         twig/




Jordi Boggiano                                              Company nelm.io
Twitter @seldaek                                                Blog seld.be
Downloading Project Dependencies
              composer.json
                   Located in project root directory
                   Defines dependencies
               1 {
               2       "require": {
               3           "silex/silex": ">=1.0.0-dev",
               4           "symfony/finder": "2.1-dev",
               5           "twig/twig": "1.*",
               6           "predis/service-provider": "dev-master"
               7       }
               8 }
              Source install: With install --prefer-source it clones/checks out the code.




Jordi Boggiano                                                                              Company nelm.io
Twitter @seldaek                                                                                Blog seld.be
Creating a Package Definition
              01 {
              02       "name": "predis/predis",
              03       "type": "library",
              04       "description": "Flexible and feature-complete Redis client",
              05       "keywords": ["nosql", "redis", "predis"],
              06       "homepage": "http://github.com/nrk/predis",
              07       "license": "MIT",
              08       "version": "0.7.1"
              09       "authors": [
              10           {
              11               "name": "Daniele Alessandri",
              12               "email": "suppakilla@gmail.com",
              13               "homepage": "http://clorophilla.net"
              14           }
              15       ],
              16       "require": {
              17           "php": ">=5.3.0"
              18       },
              19       "autoload": {
              20           "psr-0": {"Predis": "lib/"}
              21       }
              22 }
              Note: Package Definition === Application/Root Package




Jordi Boggiano                                                                        Company nelm.io
Twitter @seldaek                                                                          Blog seld.be
Avoiding version chaos
                                          in your team
              composer.lock
                   Lists packages & versions
                   Replaces composer.json
                   Created by composer install (installs your dependencies)
                   Updated by composer update (updates your dependencies)
                   Must be committed in your VCS and shipped with your releases
              Benefits
                   Everyone on a team works with exactly the same dependency versions
                   When deploying, all machines run exactly the same dependency versions
                   Users will never get dependency versions that you did not test with




Jordi Boggiano                                                                        Company nelm.io
Twitter @seldaek                                                                          Blog seld.be
Autoloading
              Libraries/projects define their namespaces:
               1 "autoload": {
               2     "psr-0": {"Predis": "lib/"}
               3 }
              Composer builds an autoloader for you:
               1 vendor/.composer/
               2     autoload_namespaces.php
               3     autoload.php
               4     ClassLoader.php
               5     installed.json
              Trashbin uses the generated autoloader:
               1   require_once __DIR__.'/../vendor/.composer/autoload.php';
               2
               3   use SilexApplication;
               4   use SilexExtensionTwigExtension;
               5
               6   use SymfonyComponentFinderFinder;
               7   use SymfonyComponentHttpFoundationResponse;
               8
               9   $app = new Application();



Jordi Boggiano                                                                 Company nelm.io
Twitter @seldaek                                                                   Blog seld.be
Autoloading Tests
              Add your own namespaces for testing purposes in PHPUnit's bootstrap:
               1 # tests/bootstrap.php
               2
               3 $loader = require_once __DIR__.'/../vendor/.composer/autoload.php';
               4
               5 $loader->add('MyTest', __DIR__);




Jordi Boggiano                                                                         Company nelm.io
Twitter @seldaek                                                                           Blog seld.be
Alternative Repositories
              01 "repositories": [
              02     {
              03         "type": "composer",
              04         "url": "http://example.org"
              05     },
              06     {
              07         "type": "vcs",
              08         "url": "git://example.org/MyRepo.git"
              09     },
              10     {
              11         "type": "pear",
              12         "url": "http://pear.example.org"
              13     },
              14     {
              15         "packagist": false
              16     }
              17 ]
              Composer Repository Implementations ($url/packages.json)
                 Packagist
                 Satis
                 (Pirum)




Jordi Boggiano                                                           Company nelm.io
Twitter @seldaek                                                             Blog seld.be
Depending on packages without composer.json
              01   "repositories": [
              02       {
              03           "type": "package",
              04           "package": {
              05               "name": "vendor/package",
              06               "version": "1.0.0",
              07               "dist": {
              08                   "url": "http://example.org/package.zip",
              09                   "type": "zip"
              10               },
              11               "source": {
              12                   "url": "git://example.org/package.git",
              13                   "type": "git",
              14                   "reference": "tag name, branch name or commit hash"
              15               }
              16           }
              17       }
              18   ],
              19   "require": {
              20       "vendor/package": "1.0.0"
              21   }
              Note: repositories are only available to the root package




Jordi Boggiano                                                                           Company nelm.io
Twitter @seldaek                                                                             Blog seld.be
State of the Project




Jordi Boggiano                            Company nelm.io
Twitter @seldaek                              Blog seld.be
Adoption
                   >500 packages on Packagist (+150 in
                   Feb.)
                   Alpha1 just released
                   Many early adopters
                   Supported by frameworks/libs
                   Chef recipes http://goo.gl/1QMKp
                   (Integration in apps for plugins)
                   (Integration by PaaS providers)


Jordi Boggiano                                           Company nelm.io
Twitter @seldaek                                             Blog seld.be
Missing Features
                   Human readable error reporting
                   User-friendliness on expected failures
                   Better support for beta/alpha/.. releases
                   Many more little things:
                   github.com/composer/composer/issues




Jordi Boggiano                                                 Company nelm.io
Twitter @seldaek                                                   Blog seld.be
Wishful Thinking
Look around.
                   Write small libs.
                      Share code.
                    Reuse things.
                   Reinvigorate PHP


Jordi Boggiano                         Company nelm.io
Twitter @seldaek                           Blog seld.be
Find Out More
                   GetComposer.org
                   Packagist.org
                   github.com/composer
                   composer-dev google group
                   #composer & #composer-dev



Jordi Boggiano                                 Company nelm.io
Twitter @seldaek                                   Blog seld.be
Thank you.




Jordi Boggiano                  Company nelm.io
Twitter @seldaek                    Blog seld.be
Questions?
                      jordi@nelm.io
                         @seldaek
                      slides.seld.be

                        Feedback:
                   http://joind.in/6051

Jordi Boggiano                            Company nelm.io
Twitter @seldaek                              Blog seld.be

Mais conteúdo relacionado

Mais procurados

Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Sergii Shymko
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Rafael Dohms
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHPRafael Dohms
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer packageLattapon Yodsuwan
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxNick Belhomme
 
Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15Rafael Dohms
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Composer The Right Way
Composer The Right WayComposer The Right Way
Composer The Right WayRafael Dohms
 
Composer the right way
Composer the right wayComposer the right way
Composer the right wayRafael Dohms
 
Composer the right way - DPC15
Composer the right way - DPC15Composer the right way - DPC15
Composer the right way - DPC15Rafael Dohms
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NLRafael Dohms
 
Composer the right way [SweetlakePHP]
Composer the right way [SweetlakePHP]Composer the right way [SweetlakePHP]
Composer the right way [SweetlakePHP]Rafael Dohms
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Rafael Dohms
 
Composer the right way - NomadPHP
Composer the right way - NomadPHPComposer the right way - NomadPHP
Composer the right way - NomadPHPRafael Dohms
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNRafael Dohms
 
Web backends development using Python
Web backends development using PythonWeb backends development using Python
Web backends development using PythonAyun Park
 
Servlet 3.1 Async I/O
Servlet 3.1 Async I/OServlet 3.1 Async I/O
Servlet 3.1 Async I/OSimone Bordet
 

Mais procurados (20)

Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer package
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
 
Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Composer The Right Way
Composer The Right WayComposer The Right Way
Composer The Right Way
 
Composer the right way
Composer the right wayComposer the right way
Composer the right way
 
Composer the right way - DPC15
Composer the right way - DPC15Composer the right way - DPC15
Composer the right way - DPC15
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
 
Composer the right way [SweetlakePHP]
Composer the right way [SweetlakePHP]Composer the right way [SweetlakePHP]
Composer the right way [SweetlakePHP]
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16
 
Composer the right way - NomadPHP
Composer the right way - NomadPHPComposer the right way - NomadPHP
Composer the right way - NomadPHP
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
 
Web backends development using Python
Web backends development using PythonWeb backends development using Python
Web backends development using Python
 
Servlet 3.1 Async I/O
Servlet 3.1 Async I/OServlet 3.1 Async I/O
Servlet 3.1 Async I/O
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 

Destaque

Whitepaper the mobile-commerce-impact
Whitepaper the mobile-commerce-impactWhitepaper the mobile-commerce-impact
Whitepaper the mobile-commerce-impactVengat Owen
 
Nolahouse
NolahouseNolahouse
Nolahousecarcin
 
Lgelectronics 110912130948-phpapp02
Lgelectronics 110912130948-phpapp02Lgelectronics 110912130948-phpapp02
Lgelectronics 110912130948-phpapp02Rizwan Ahmad
 
Những tác phẩm điêu khắc ngoài trời thú vị
Những tác phẩm điêu khắc ngoài trời thú vịNhững tác phẩm điêu khắc ngoài trời thú vị
Những tác phẩm điêu khắc ngoài trời thú vịCarysil Vietnam
 
Drupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeDrupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeAdyax
 
J O B S I
J  O  B  S  IJ  O  B  S  I
J O B S Ikeydiva
 
Общественный контроль за полицией в Волгодонске
Общественный контроль за полицией в ВолгодонскеОбщественный контроль за полицией в Волгодонске
Общественный контроль за полицией в ВолгодонскеVadim Karastelev
 
Bloemen
BloemenBloemen
BloemenMoensM
 
маски Dual system
маски Dual systemмаски Dual system
маски Dual systemLiza Alypova
 

Destaque (18)

CRISE - INSTITUT 2012 - Brian Mishara - Enjeux et défis en prévention du suic...
CRISE - INSTITUT 2012 - Brian Mishara - Enjeux et défis en prévention du suic...CRISE - INSTITUT 2012 - Brian Mishara - Enjeux et défis en prévention du suic...
CRISE - INSTITUT 2012 - Brian Mishara - Enjeux et défis en prévention du suic...
 
Why Towels
Why TowelsWhy Towels
Why Towels
 
Trabajo carol sql
Trabajo  carol sqlTrabajo  carol sql
Trabajo carol sql
 
Whitepaper the mobile-commerce-impact
Whitepaper the mobile-commerce-impactWhitepaper the mobile-commerce-impact
Whitepaper the mobile-commerce-impact
 
Solution cz
Solution czSolution cz
Solution cz
 
Nolahouse
NolahouseNolahouse
Nolahouse
 
Lgelectronics 110912130948-phpapp02
Lgelectronics 110912130948-phpapp02Lgelectronics 110912130948-phpapp02
Lgelectronics 110912130948-phpapp02
 
Paypersocials
PaypersocialsPaypersocials
Paypersocials
 
Cmmaao action-pmi-pmp
Cmmaao action-pmi-pmpCmmaao action-pmi-pmp
Cmmaao action-pmi-pmp
 
Những tác phẩm điêu khắc ngoài trời thú vị
Những tác phẩm điêu khắc ngoài trời thú vịNhững tác phẩm điêu khắc ngoài trời thú vị
Những tác phẩm điêu khắc ngoài trời thú vị
 
Task 2
Task 2Task 2
Task 2
 
Drupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeDrupal usage by example : World Food Programme
Drupal usage by example : World Food Programme
 
J O B S I
J  O  B  S  IJ  O  B  S  I
J O B S I
 
Общественный контроль за полицией в Волгодонске
Общественный контроль за полицией в ВолгодонскеОбщественный контроль за полицией в Волгодонске
Общественный контроль за полицией в Волгодонске
 
Image ideas
Image ideasImage ideas
Image ideas
 
Bloemen
BloemenBloemen
Bloemen
 
маски Dual system
маски Dual systemмаски Dual system
маски Dual system
 
Esculturas de Areia
Esculturas de AreiaEsculturas de Areia
Esculturas de Areia
 

Semelhante a Dependency Management with Composer

international PHP2011_Jordi Boggiano_PHP Reset
international PHP2011_Jordi Boggiano_PHP Resetinternational PHP2011_Jordi Boggiano_PHP Reset
international PHP2011_Jordi Boggiano_PHP Resetsmueller_sandsmedia
 
Of metacello, git, scripting and things
Of metacello, git, scripting and thingsOf metacello, git, scripting and things
Of metacello, git, scripting and thingsESUG
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern developmentRoman Veselý
 
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OSMartin de Keijzer
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.comMathieu Buffenoir
 
Intro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsIntro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsManuel Carrasco Moñino
 
How to create a local Android open source project mirror in 6 easy steps
How to create a local Android open source project mirror in 6 easy stepsHow to create a local Android open source project mirror in 6 easy steps
How to create a local Android open source project mirror in 6 easy stepsDeveo
 
Porion a new Build Manager
Porion a new Build ManagerPorion a new Build Manager
Porion a new Build ManagerStephane Carrez
 
2012 09-04 smart devcon - boot to the web, boot 2 gecko
2012 09-04 smart devcon - boot to the web, boot 2 gecko2012 09-04 smart devcon - boot to the web, boot 2 gecko
2012 09-04 smart devcon - boot to the web, boot 2 geckoMartin de Keijzer
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDocker, Inc.
 
Monorepo: React Web & React Native
Monorepo: React Web & React NativeMonorepo: React Web & React Native
Monorepo: React Web & React NativeEugene Zharkov
 
Building and Customizing CoreOS
Building and Customizing CoreOSBuilding and Customizing CoreOS
Building and Customizing CoreOS雄也 日下部
 
CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023Anthony Dahanne
 
Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer John Riviello
 
Presentazione resin.io
Presentazione resin.ioPresentazione resin.io
Presentazione resin.ioGianluca Leo
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developersWim Godden
 
Conhecendo o-composer-por-nandokstronet
Conhecendo o-composer-por-nandokstronetConhecendo o-composer-por-nandokstronet
Conhecendo o-composer-por-nandokstronetCode Experts Learning
 
Docker Runtime Security
Docker Runtime SecurityDocker Runtime Security
Docker Runtime SecuritySysdig
 

Semelhante a Dependency Management with Composer (20)

PHP Reset
PHP ResetPHP Reset
PHP Reset
 
international PHP2011_Jordi Boggiano_PHP Reset
international PHP2011_Jordi Boggiano_PHP Resetinternational PHP2011_Jordi Boggiano_PHP Reset
international PHP2011_Jordi Boggiano_PHP Reset
 
Of metacello, git, scripting and things
Of metacello, git, scripting and thingsOf metacello, git, scripting and things
Of metacello, git, scripting and things
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern development
 
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
2012 11-01 Hackers & founders - Boot to the web, boot 2 gecko / Firefox OS
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
 
Intro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsIntro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin Elements
 
How to create a local Android open source project mirror in 6 easy steps
How to create a local Android open source project mirror in 6 easy stepsHow to create a local Android open source project mirror in 6 easy steps
How to create a local Android open source project mirror in 6 easy steps
 
Porion a new Build Manager
Porion a new Build ManagerPorion a new Build Manager
Porion a new Build Manager
 
2012 09-04 smart devcon - boot to the web, boot 2 gecko
2012 09-04 smart devcon - boot to the web, boot 2 gecko2012 09-04 smart devcon - boot to the web, boot 2 gecko
2012 09-04 smart devcon - boot to the web, boot 2 gecko
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
 
Monorepo: React Web & React Native
Monorepo: React Web & React NativeMonorepo: React Web & React Native
Monorepo: React Web & React Native
 
Building and Customizing CoreOS
Building and Customizing CoreOSBuilding and Customizing CoreOS
Building and Customizing CoreOS
 
CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023CNCF Québec Meetup du 16 Novembre 2023
CNCF Québec Meetup du 16 Novembre 2023
 
CocoaPods.pptx
CocoaPods.pptxCocoaPods.pptx
CocoaPods.pptx
 
Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer
 
Presentazione resin.io
Presentazione resin.ioPresentazione resin.io
Presentazione resin.io
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Conhecendo o-composer-por-nandokstronet
Conhecendo o-composer-por-nandokstronetConhecendo o-composer-por-nandokstronet
Conhecendo o-composer-por-nandokstronet
 
Docker Runtime Security
Docker Runtime SecurityDocker Runtime Security
Docker Runtime Security
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Dependency Management with Composer

  • 2. About Me Belgian living in Zürich, Switzerland Building the internet for 10 years http://seld.be Symfony2, Composer and other OSS contributions http://github.com/Seldaek Working at Nelmio http://nelm.io Symfony2 & frontend performance consulting Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 3. Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 4. Managing Packages vs Dependencies Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 5. Package Management in PHP Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 6. The Composer Ecosystem github.com/composer Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 7. The Composer Ecosystem Composer - CLI Tool Easy to use Installs deps per-project Flexible and embeddable Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 8. The Composer Ecosystem Packagist - Package Repository Aggregates PHP libraries Open to all OSS projects Feeds on VCS repositories Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 9.
  • 10. Early adopters are loving it Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 11. The Composer Ecosystem Satis - Micro Repository Minimalistic Useful for closed code Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 13. Using a Composed Project git clone https://github.com/igorw/trashbin Cloning into trashbin... cd trashbin/ curl -s http://getcomposer.org/installer | php All settings correct for using Composer Composer successfully installed to: /home/bob/trashbin/composer.phar Use it: php composer.phar Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 14. Using a Composed Project php composer.phar install Installing from lock file - Package symfony/class-loader (2.1.0-dev) Downloading Unpacking archive Cleaning up [...] - Package predis/predis (dev-master) Downloading Unpacking archive Cleaning up - Package twig/twig (1.6.0) Downloading Unpacking archive Cleaning up Generating autoload files Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 15. Using a Composed Project 01 vendor/ 02 .composer/ 03 bin/ 04 pimple/ 05 pimple/ 06 predis/ 07 predis/ 08 service-provider/ 09 silex/ 10 silex/ 11 symfony/ 12 browser-kit/ 13 class-loader/ 14 css-selector/ 15 dom-crawler/ 16 event-dispatcher/ 17 finder/ 18 http-foundation/ 19 http-kernel/ 20 routing/ 21 twig/ 22 twig/ Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 16. Downloading Project Dependencies composer.json Located in project root directory Defines dependencies 1 { 2 "require": { 3 "silex/silex": ">=1.0.0-dev", 4 "symfony/finder": "2.1-dev", 5 "twig/twig": "1.*", 6 "predis/service-provider": "dev-master" 7 } 8 } Source install: With install --prefer-source it clones/checks out the code. Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 17. Creating a Package Definition 01 { 02 "name": "predis/predis", 03 "type": "library", 04 "description": "Flexible and feature-complete Redis client", 05 "keywords": ["nosql", "redis", "predis"], 06 "homepage": "http://github.com/nrk/predis", 07 "license": "MIT", 08 "version": "0.7.1" 09 "authors": [ 10 { 11 "name": "Daniele Alessandri", 12 "email": "suppakilla@gmail.com", 13 "homepage": "http://clorophilla.net" 14 } 15 ], 16 "require": { 17 "php": ">=5.3.0" 18 }, 19 "autoload": { 20 "psr-0": {"Predis": "lib/"} 21 } 22 } Note: Package Definition === Application/Root Package Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 18. Avoiding version chaos in your team composer.lock Lists packages & versions Replaces composer.json Created by composer install (installs your dependencies) Updated by composer update (updates your dependencies) Must be committed in your VCS and shipped with your releases Benefits Everyone on a team works with exactly the same dependency versions When deploying, all machines run exactly the same dependency versions Users will never get dependency versions that you did not test with Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 19. Autoloading Libraries/projects define their namespaces: 1 "autoload": { 2 "psr-0": {"Predis": "lib/"} 3 } Composer builds an autoloader for you: 1 vendor/.composer/ 2 autoload_namespaces.php 3 autoload.php 4 ClassLoader.php 5 installed.json Trashbin uses the generated autoloader: 1 require_once __DIR__.'/../vendor/.composer/autoload.php'; 2 3 use SilexApplication; 4 use SilexExtensionTwigExtension; 5 6 use SymfonyComponentFinderFinder; 7 use SymfonyComponentHttpFoundationResponse; 8 9 $app = new Application(); Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 20. Autoloading Tests Add your own namespaces for testing purposes in PHPUnit's bootstrap: 1 # tests/bootstrap.php 2 3 $loader = require_once __DIR__.'/../vendor/.composer/autoload.php'; 4 5 $loader->add('MyTest', __DIR__); Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 21. Alternative Repositories 01 "repositories": [ 02 { 03 "type": "composer", 04 "url": "http://example.org" 05 }, 06 { 07 "type": "vcs", 08 "url": "git://example.org/MyRepo.git" 09 }, 10 { 11 "type": "pear", 12 "url": "http://pear.example.org" 13 }, 14 { 15 "packagist": false 16 } 17 ] Composer Repository Implementations ($url/packages.json) Packagist Satis (Pirum) Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 22. Depending on packages without composer.json 01 "repositories": [ 02 { 03 "type": "package", 04 "package": { 05 "name": "vendor/package", 06 "version": "1.0.0", 07 "dist": { 08 "url": "http://example.org/package.zip", 09 "type": "zip" 10 }, 11 "source": { 12 "url": "git://example.org/package.git", 13 "type": "git", 14 "reference": "tag name, branch name or commit hash" 15 } 16 } 17 } 18 ], 19 "require": { 20 "vendor/package": "1.0.0" 21 } Note: repositories are only available to the root package Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 23. State of the Project Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 24.
  • 25. Adoption >500 packages on Packagist (+150 in Feb.) Alpha1 just released Many early adopters Supported by frameworks/libs Chef recipes http://goo.gl/1QMKp (Integration in apps for plugins) (Integration by PaaS providers) Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 26. Missing Features Human readable error reporting User-friendliness on expected failures Better support for beta/alpha/.. releases Many more little things: github.com/composer/composer/issues Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 28. Look around. Write small libs. Share code. Reuse things. Reinvigorate PHP Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 29. Find Out More GetComposer.org Packagist.org github.com/composer composer-dev google group #composer & #composer-dev Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 30. Thank you. Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be
  • 31. Questions? jordi@nelm.io @seldaek slides.seld.be Feedback: http://joind.in/6051 Jordi Boggiano Company nelm.io Twitter @seldaek Blog seld.be