SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Composing Project
  Dependencies
          Derek Gallo
          @derekgallo
    http://github.com/drock
Problem
•Projects use many libs or
 frameworks
•Most libs have several
 dependencies
•Different projects need
 different versions
An Example
          Project A                   Project B




          PHPUnit                     PHPUnit
            3.7                         3.6




Symfony   PHPUnit           Symfony   PHPUnit
 YAML      Mocks      ...    YAML      Mocks      ...
  2.2       1.3               1.02      1.1
Pear
Project A             Project B

                                  Single shared
                                  dependency

            PHPUnit               No autoloading
              3.7

                                  Not part of build

 Symfony    PHPUnit
  YAML       Mocks       ...
   2.2        1.3
Submodules
          Project A                       Project B




          Symfony     PHPUnit             Symfony     PHPUnit
PHPUnit                         PHPUnit
           YAML        Mocks               YAML        Mocks
  3.7                             3.6
            2.2         1.3                 1.02        1.1



           No autoloading

           No dependency management
Composer!
          Project A                   Project B




          PHPUnit                     PHPUnit
            3.7                         3.6




Symfony   PHPUnit           Symfony   PHPUnit
 YAML      Mocks      ...    YAML      Mocks      ...
  2.2       1.3               1.02      1.1
Composer!

 •Autoloading
 • Dependency Management
 • Per project dependencies
 • Part of build
Composer is a tool for
dependency management
in PHP. It allows you to
declare the dependent
libraries your project needs
and it will install them in
your project for you.
Installation
  •Locally
   • curl -sS https://getcomposer.org/
      installer | php

  •Globally
   • sudo mv composer.phar /usr/local/bin/
      composer

  • composer selfupdate <- Do regularly
Silex Sample


  •Create empty project
   folder
  •   Create composer.json
Silex Sample
Silex Sample
• >composer install
Silex Sample
  • include autoloader
  • write controller
Silex Sample
  • add monolog
Silex Sample
  • >composer update
Silex Sample
  • add logging code
Defining
Dependencies
        Vendor/Package



                           Version




                           Stability
                         Requirements
Installing
Dependencies
•   >composer install
• downloads
 dependencies to
 vendor folder
•generates
 autoloader
Using Dependencies
  •PSR-0 - Standards
   defining naming
   conventions for
   autoloading.
  •Use composer generated
   autoloader
Updating
Dependencies
 •>composer update
 • upgrades packages to
  latest version based on
  rules in composer.json
Install vs Update
 •composer.lock
  •tracks versions of
    dependencies used
  •commit it
 •install-looks for composer.lock
   then composer.json
 •update-looks straight at
   composer.json and updates
   composer.lock
Working in a Team
•Elect a dependency
 manager
 •  manages and commits
    composer files
•add vendor folder to git/svn
 ignore
Finding Packages

  •Packagist
   • >composer search ...
  • Github
   • look for composer.json
Older Packages
                         Define a package
                        repository in your
                          composer.json


                                             Specify locations of
                                                   sources




                                  Instruct autoloader




• Hopefully its PSR-0 compliant
Bleeding Edge
         Version Tag
                       Version Branch




                         Other Branch
Custom Forks
 • Fork on Github
 • Add your repo
 • Specify your branch
Bootstrapping
>composer create-project -s dev fabpot/silex-skeleton .
More?
 • http://getcomposer.org
 • http://packagist.org
 • https://github.com/php-fig/fig-
   standards/blob/master/accepted/



            Thanks
                  Derek Gallo
                  @derekgallo
            http://github.com/drock

Más contenido relacionado

La actualidad más candente

An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to MavenJoao Pereira
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using MavenScheidt & Bachmann
 
Log management (elk) for spring boot application
Log management (elk) for spring boot applicationLog management (elk) for spring boot application
Log management (elk) for spring boot applicationVadym Lotar
 
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)IT Arena
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginYasuharu Nakano
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache MavenRajind Ruparathna
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezDevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezAnthony Alvarez
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesJesse Gallagher
 

La actualidad más candente (20)

An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to Maven
 
Maven
MavenMaven
Maven
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Log management (elk) for spring boot application
Log management (elk) for spring boot applicationLog management (elk) for spring boot application
Log management (elk) for spring boot application
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Maven tutorial for beginners
Maven tutorial for beginnersMaven tutorial for beginners
Maven tutorial for beginners
 
MVVM on iOS
MVVM on iOSMVVM on iOS
MVVM on iOS
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
Jenkins
JenkinsJenkins
Jenkins
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezDevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPages
 

Destacado

Destacado (6)

Guide to Project Portfolio Management
Guide to Project Portfolio ManagementGuide to Project Portfolio Management
Guide to Project Portfolio Management
 
portfolio management PPT
portfolio management PPTportfolio management PPT
portfolio management PPT
 
Portfolio mangement
Portfolio mangementPortfolio mangement
Portfolio mangement
 
Project Planning
Project PlanningProject Planning
Project Planning
 
Introduction portfolio management
Introduction portfolio managementIntroduction portfolio management
Introduction portfolio management
 
Project Portfolio Management
Project Portfolio ManagementProject Portfolio Management
Project Portfolio Management
 

Similar a Composing Project Dependencies

Composer Lightning Talk
Composer Lightning TalkComposer Lightning Talk
Composer Lightning TalkEric Johnson
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHPTareq Hasan
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with ComposerAdam Englander
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedbackNicolas Degardin
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupaldrubb
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Fabien Potencier
 
Symfony2 components to the rescue of your PHP projects
Symfony2 components to the rescue of your PHP projectsSymfony2 components to the rescue of your PHP projects
Symfony2 components to the rescue of your PHP projectsXavier Lacot
 
Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Max Romanovsky
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovskyphp-user-group-minsk
 
Developing Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDBDeveloping Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDBMongoDB
 
Mongo db bangalore 2012
Mongo db bangalore 2012Mongo db bangalore 2012
Mongo db bangalore 2012MongoDB
 
Symfony 4: A new way to develop applications #ipc19
Symfony 4: A new way to develop applications #ipc19Symfony 4: A new way to develop applications #ipc19
Symfony 4: A new way to develop applications #ipc19Antonio Peric-Mazar
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Meet Magento Italy
 
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
 

Similar a Composing Project Dependencies (20)

Composer Lightning Talk
Composer Lightning TalkComposer Lightning Talk
Composer Lightning Talk
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHP
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedback
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
Composer
ComposerComposer
Composer
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3
 
Symfony2 components to the rescue of your PHP projects
Symfony2 components to the rescue of your PHP projectsSymfony2 components to the rescue of your PHP projects
Symfony2 components to the rescue of your PHP projects
 
Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
Developing Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDBDeveloping Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDB
 
Mongo db bangalore 2012
Mongo db bangalore 2012Mongo db bangalore 2012
Mongo db bangalore 2012
 
Composer
ComposerComposer
Composer
 
Composer
ComposerComposer
Composer
 
Symfony 4: A new way to develop applications #ipc19
Symfony 4: A new way to develop applications #ipc19Symfony 4: A new way to develop applications #ipc19
Symfony 4: A new way to develop applications #ipc19
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
 
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
 
Composer
ComposerComposer
Composer
 

Último

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Último (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Composing Project Dependencies

  • 1. Composing Project Dependencies Derek Gallo @derekgallo http://github.com/drock
  • 2. Problem •Projects use many libs or frameworks •Most libs have several dependencies •Different projects need different versions
  • 3. An Example Project A Project B PHPUnit PHPUnit 3.7 3.6 Symfony PHPUnit Symfony PHPUnit YAML Mocks ... YAML Mocks ... 2.2 1.3 1.02 1.1
  • 4. Pear Project A Project B Single shared dependency PHPUnit No autoloading 3.7 Not part of build Symfony PHPUnit YAML Mocks ... 2.2 1.3
  • 5. Submodules Project A Project B Symfony PHPUnit Symfony PHPUnit PHPUnit PHPUnit YAML Mocks YAML Mocks 3.7 3.6 2.2 1.3 1.02 1.1 No autoloading No dependency management
  • 6. Composer! Project A Project B PHPUnit PHPUnit 3.7 3.6 Symfony PHPUnit Symfony PHPUnit YAML Mocks ... YAML Mocks ... 2.2 1.3 1.02 1.1
  • 7. Composer! •Autoloading • Dependency Management • Per project dependencies • Part of build
  • 8. Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.
  • 9. Installation •Locally • curl -sS https://getcomposer.org/ installer | php •Globally • sudo mv composer.phar /usr/local/bin/ composer • composer selfupdate <- Do regularly
  • 10. Silex Sample •Create empty project folder • Create composer.json
  • 13. Silex Sample • include autoloader • write controller
  • 14. Silex Sample • add monolog
  • 15. Silex Sample • >composer update
  • 16. Silex Sample • add logging code
  • 17. Defining Dependencies Vendor/Package Version Stability Requirements
  • 18. Installing Dependencies • >composer install • downloads dependencies to vendor folder •generates autoloader
  • 19. Using Dependencies •PSR-0 - Standards defining naming conventions for autoloading. •Use composer generated autoloader
  • 20. Updating Dependencies •>composer update • upgrades packages to latest version based on rules in composer.json
  • 21. Install vs Update •composer.lock •tracks versions of dependencies used •commit it •install-looks for composer.lock then composer.json •update-looks straight at composer.json and updates composer.lock
  • 22. Working in a Team •Elect a dependency manager • manages and commits composer files •add vendor folder to git/svn ignore
  • 23. Finding Packages •Packagist • >composer search ... • Github • look for composer.json
  • 24. Older Packages Define a package repository in your composer.json Specify locations of sources Instruct autoloader • Hopefully its PSR-0 compliant
  • 25. Bleeding Edge Version Tag Version Branch Other Branch
  • 26. Custom Forks • Fork on Github • Add your repo • Specify your branch
  • 27. Bootstrapping >composer create-project -s dev fabpot/silex-skeleton .
  • 28. More? • http://getcomposer.org • http://packagist.org • https://github.com/php-fig/fig- standards/blob/master/accepted/ Thanks Derek Gallo @derekgallo http://github.com/drock