Your SlideShare is downloading. ×
0
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Composing Project Dependencies
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Composing Project Dependencies

1,185

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,185
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  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.6Symfony PHPUnit Symfony PHPUnit YAML Mocks ... YAML Mocks ... 2.2 1.3 1.02 1.1
  4. PearProject 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 PHPUnitPHPUnit 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.6Symfony 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 fordependency managementin PHP. It allows you todeclare the dependentlibraries your project needsand it will install them inyour 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
  11. Silex Sample
  12. Silex Sample• >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. DefiningDependencies Vendor/Package Version Stability Requirements
  18. InstallingDependencies• >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. UpdatingDependencies •>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

×