Composing Project Dependencies

download Composing Project Dependencies

of 28

  • date post

    06-May-2015
  • Category

    Technology

  • view

    1.171
  • download

    0

Embed Size (px)

Transcript of Composing Project Dependencies

  • 1.Composing ProjectDependenciesDerek Gallo@derekgallohttp://github.com/drock

2. ProblemProjects use many libs or frameworksMost libs have several dependenciesDifferent projects need different versions 3. An ExampleProject A Project BPHPUnit PHPUnit3.7 3.6Symfony PHPUnit Symfony PHPUnit YAMLMocks...YAMLMocks...2.2 1.3 1.021.1 4. PearProject A Project BSingle shareddependencyPHPUnit No autoloading3.7Not part of build SymfonyPHPUnitYAML Mocks ... 2.21.3 5. SubmodulesProject A Project BSymfony PHPUnit Symfony PHPUnitPHPUnit PHPUnit YAMLMocks YAMLMocks3.7 3.62.2 1.3 1.021.1 No autoloading No dependency management 6. Composer!Project A Project BPHPUnit PHPUnit3.7 3.6Symfony PHPUnit Symfony PHPUnit YAMLMocks...YAMLMocks...2.2 1.3 1.021.1 7. Composer! Autoloading Dependency Management Per project dependencies Part of build 8. Composer is a tool fordependency managementin PHP. It allows you todeclare the dependentlibraries your project needsand it will install them inyour project for you. 9. InstallationLocally curl -sS https://getcomposer.org/installer | phpGlobally sudo mv composer.phar /usr/local/bin/composer composer selfupdate composer install 13. Silex Sample include autoloader write controller 14. Silex Sample add monolog 15. Silex Sample >composer update 16. Silex Sample add logging code 17. DefiningDependenciesVendor/Package Version Stability Requirements 18. InstallingDependencies >composer install downloads dependencies to vendor foldergenerates autoloader 19. Using DependenciesPSR-0 - Standards defining naming conventions for autoloading.Use composer generated autoloader 20. UpdatingDependencies >composer update upgrades packages tolatest version based onrules in composer.json 21. Install vs Update composer.locktracks versions ofdependencies usedcommit it install-looks for composer.lock then composer.json update-looks straight at composer.json and updates composer.lock 22. Working in a TeamElect a dependency manager manages and commitscomposer filesadd vendor folder to git/svn ignore 23. Finding PackagesPackagist >composer search ... Github look for composer.json 24. Older Packages Dene a packagerepository in yourcomposer.json Specify locations of sourcesInstruct 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/ThanksDerek Gallo@derekgallohttp://github.com/drock