Successfully reported this slideshow.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Composer for Busy Developers - php|tek13

  1. 1. C!"p#$rPutting your dependencies on the score Rafael Dohms / @rdohms
  2. 2. photocredit:EliWhite Evangelist, Speaker and Contributor. Developer at WEBclusive. Enabler at AmsterdamPHP. Rafael Dohms @rdohms
  3. 3. photocredit:EliWhite Evangelist, Speaker and Contributor. Developer at WEBclusive. Enabler at AmsterdamPHP. Rafael Dohms @rdohms
  4. 4. %$ E&$v'(!r P)(*+ a general introduction to Composer Ev$r,-', *!"p#)./ the basic stuff you need to know Up/r'-)./ (! ' M'$0(r! advanced features for more complex scenarios 1.-)./ ,!2r (2.$ discovering and sharing libraries
  5. 5. %$ E&$v'(!r P)(*+
  6. 6. per project system wide central repository open acceptance spread out channels strict standards
  7. 7. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project
  8. 8. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.:
  9. 9. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR
  10. 10. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals
  11. 11. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules
  12. 12. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules vendor management script
  13. 13. Pr!b&$": I need my team and my deployments to use consistent versions of the dependencies of my project S!&2()!.: PEAR SVN Externals Git Submodules vendor management script C!"p#$r!
  14. 14. A per-project dependency manager that allows you to declare a consistent list of dependencies and versions for your application, as well as a consistent way of sharing your libraries and making them discoverable using packagist.org
  15. 15. Ev$r,-', C!"p#)./
  16. 16. I.0('&&)./ C!"p#$r $ curl -s http://getcomposer.org/installer | php $ curl -s http://getcomposer.org/installer | php -- --install-dir=bin Local (embed) Global
  17. 17. I.0('&&)./ C!"p#$r $ curl -s http://getcomposer.org/installer | php $ curl -s http://getcomposer.org/installer | php -- --install-dir=bin Local (embed) Global $ ln -s /usr/bin/composer.phar /usr/bin/composer3p:
  18. 18. I.0('&&)./ C!"p#$r
  19. 19. I.0('&&)./ C!"p#$r $ composer.phar --version Composer version 7073d38
  20. 20. I.0('&&)./ C!"p#$r $ composer.phar --version Composer version 7073d38 php
  21. 21. K$$p )( 2p-'($-!
  22. 22. K$$p )( 2p-'($-! $ composer.phar self-update Updating to version 7073d38. Downloading: 100%
  23. 23. I’" b2)&-)./ ' Pr!4$*( How can composer manage your dependencies
  24. 24. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0
  25. 25. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject
  26. 26. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject $ vim composer.json { "require": { "silex/silex": "~1.0" } }
  27. 27. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject $ vim composer.json { "require": { "silex/silex": "~1.0" } } put this in your project root
  28. 28. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject $ vim composer.json { "require": { "silex/silex": "~1.0" } } put this in your project root “require”: required packages and versions adv. ex.: >=1.0.0,<1.2-dev or ~1.1
  29. 29. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject $ vim composer.json { "require": { "silex/silex": "~1.0" } } put this in your project root “require”: required packages and versions adv. ex.: >=1.0.0,<1.2-dev or ~1.1
  30. 30. C!"p#$r 101 G$(()./ (+$ -$p$.-$.*)$0 $ cd ~/dev/myproject $ vim composer.json $ composer.phar install { "require": { "silex/silex": "~1.0" } } put this in your project root “require”: required packages and versions adv. ex.: >=1.0.0,<1.2-dev or ~1.1
  31. 31. Loading composer repositories with package information Installing dependencies - Installing psr/log (1.0.0) Loading from cache - Installing symfony/routing (v2.2.1) Downloading: 100% - Installing symfony/http-foundation (v2.2.1) Downloading: 100% - Installing symfony/event-dispatcher (v2.2.1) Loading from cache - Installing symfony/http-kernel (v2.2.1) Downloading: 100% - Installing pimple/pimple (v1.0.2) Downloading: 100% - Installing silex/silex (v1.0.0) Downloading: 100% symfony/routing suggests installing symfony/config (2.2.*) symfony/routing suggests installing symfony/yaml (2.2.*) [...] silex/silex suggests installing symfony/dom-crawler (>=2.1,<2.4-dev) silex/silex suggests installing symfony/form (>= 2.1.4,<2.4-dev) Writing lock file Generating autoload files
  32. 32. Loading composer repositories with package information Installing dependencies - Installing psr/log (1.0.0) Loading from cache - Installing symfony/routing (v2.2.1) Downloading: 100% - Installing symfony/http-foundation (v2.2.1) Downloading: 100% - Installing symfony/event-dispatcher (v2.2.1) Loading from cache - Installing symfony/http-kernel (v2.2.1) Downloading: 100% - Installing pimple/pimple (v1.0.2) Downloading: 100% - Installing silex/silex (v1.0.0) Downloading: 100% symfony/routing suggests installing symfony/config (2.2.*) symfony/routing suggests installing symfony/yaml (2.2.*) [...] silex/silex suggests installing symfony/dom-crawler (>=2.1,<2.4-dev) silex/silex suggests installing symfony/form (>= 2.1.4,<2.4-dev) Writing lock file Generating autoload files your dependency’s dependencies
  33. 33. Loading composer repositories with package information Installing dependencies - Installing psr/log (1.0.0) Loading from cache - Installing symfony/routing (v2.2.1) Downloading: 100% - Installing symfony/http-foundation (v2.2.1) Downloading: 100% - Installing symfony/event-dispatcher (v2.2.1) Loading from cache - Installing symfony/http-kernel (v2.2.1) Downloading: 100% - Installing pimple/pimple (v1.0.2) Downloading: 100% - Installing silex/silex (v1.0.0) Downloading: 100% symfony/routing suggests installing symfony/config (2.2.*) symfony/routing suggests installing symfony/yaml (2.2.*) [...] silex/silex suggests installing symfony/dom-crawler (>=2.1,<2.4-dev) silex/silex suggests installing symfony/form (>= 2.1.4,<2.4-dev) Writing lock file Generating autoload files your dependency your dependency’s dependencies
  34. 34. Loading composer repositories with package information Installing dependencies - Installing psr/log (1.0.0) Loading from cache - Installing symfony/routing (v2.2.1) Downloading: 100% - Installing symfony/http-foundation (v2.2.1) Downloading: 100% - Installing symfony/event-dispatcher (v2.2.1) Loading from cache - Installing symfony/http-kernel (v2.2.1) Downloading: 100% - Installing pimple/pimple (v1.0.2) Downloading: 100% - Installing silex/silex (v1.0.0) Downloading: 100% symfony/routing suggests installing symfony/config (2.2.*) symfony/routing suggests installing symfony/yaml (2.2.*) [...] silex/silex suggests installing symfony/dom-crawler (>=2.1,<2.4-dev) silex/silex suggests installing symfony/form (>= 2.1.4,<2.4-dev) Writing lock file Generating autoload files your dependency your dependency’s dependencies suggestions of other packages, for further features
  35. 35. “~1.0” V$r0)!.)./ G$( (+$ -!(0 ). ' r!w “>=1.0” “>=1.0, <=1.1” “1.0.*”
  36. 36. “~1.0” V$r0)!.)./ G$( (+$ -!(0 ). ' r!w “>=1.0” “>=1.0, <=1.1” “1.0.*” >=1.0, <=2.0: BC Compatible releases
  37. 37. V$r0)!.)./: D$v G$(()./ 0('b&$ !r -$v v$r0)!.0
  38. 38. V$r0)!.)./: D$v G$(()./ 0('b&$ !r -$v v$r0)!.0 “minimum-stability”: “stable”
  39. 39. V$r0)!.)./: D$v G$(()./ 0('b&$ !r -$v v$r0)!.0 “minimum-stability”: “stable” No dev versions in dependency tree
  40. 40. V$r0)!.)./: D$v G$(()./ 0('b&$ !r -$v v$r0)!.0 “minimum-stability”: “stable” No dev versions in dependency tree “dms/dms”: “1.0.0@dev”
  41. 41. V$r0)!.)./: D$v G$(()./ 0('b&$ !r -$v v$r0)!.0 “minimum-stability”: “stable” No dev versions in dependency tree “dms/dms”: “1.0.0@dev” Allow this package to use unstable versions
  42. 42. Q2)*5! I +'v$ '. )-$'! B!#(r'pp)./ Pr!4$*(0
  43. 43. Q2)*5! I +'v$ '. )-$'! B!#(r'pp)./ Pr!4$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject
  44. 44. Q2)*5! I +'v$ '. )-$'! B!#(r'pp)./ Pr!4$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject Installing fabpot/silex-skeleton (v1.0.0) - Installing fabpot/silex-skeleton (v1.0.0) Downloading: 100% Created project in project Loading composer repositories with package information Installing dependencies - Installing pimple/pimple (dev-master) Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be [...] symfony/routing suggests installing symfony/yaml (dev-master) [...] Writing lock file Generating autoload files
  45. 45. Q2)*5! I +'v$ '. )-$'! B!#(r'pp)./ Pr!4$*(0 $ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject Installing fabpot/silex-skeleton (v1.0.0) - Installing fabpot/silex-skeleton (v1.0.0) Downloading: 100% Created project in project Loading composer repositories with package information Installing dependencies - Installing pimple/pimple (dev-master) Cloning d2cfa2f02f50abef65c238747c753a5f6786f6be [...] symfony/routing suggests installing symfony/yaml (dev-master) [...] Writing lock file Generating autoload files myproject/ composer.jsoncomposer.lockconfig/ console/ src/ templates/ vendor/ web/
  46. 46. A--)./ .$w R$q2)r$"$.(0 $ composer.phar require symfony/yaml=~2.1.0
  47. 47. A--)./ .$w R$q2)r$"$.(0 $ composer.phar require symfony/yaml=~2.1.0 composer.json has been updated Loading composer repositories with package information Updating dependencies - Installing symfony/yaml (v2.1.8) Downloading: 100% Writing lock file Generating autoload files
  48. 48. H!w -! I 6.-/&!'- (+$ 6&$0? PSR-0 and the modern autoloader
  49. 49. Composer generates an autoload file for all your dependencies
  50. 50. Composer generates an autoload file for all your dependencies vendor/autoload.php
  51. 51. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] },
  52. 52. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] }, “autoload”: describes the autoloading needed for your library
  53. 53. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] }, “autoload”: describes the autoloading needed for your library “psr-0”: PSR-0 Compatible libraries
  54. 54. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] }, “autoload”: describes the autoloading needed for your library “classmap”: Old PEAR packages and other libraries “psr-0”: PSR-0 Compatible libraries
  55. 55. "autoload": {     "psr-0": { "MyNamespace": "<root>" }, "classmap": ["src/", "lib/", "Something.php"], "files": ["src/MyLibrary/functions.php"] }, “autoload”: describes the autoloading needed for your library “classmap”: Old PEAR packages and other libraries “files”: for php functions or initializations “psr-0”: PSR-0 Compatible libraries
  56. 56. I .$$- ,!2r 0$rv$r (! +'v$ (+$0$.. C+$*5)./ 0,0($" -$p$.-$.*)$0
  57. 57. { "require": { "php": ">=5.3.3", "ext-ldap": "*" } } I .$$- ,!2r 0$rv$r (! +'v$ (+$0$.. C+$*5)./ 0,0($" -$p$.-$.*)$0
  58. 58. { "require": { "php": ">=5.3.3", "ext-ldap": "*" } } “php”: PHP version. I .$$- ,!2r 0$rv$r (! +'v$ (+$0$.. C+$*5)./ 0,0($" -$p$.-$.*)$0
  59. 59. { "require": { "php": ">=5.3.3", "ext-ldap": "*" } } “php”: PHP version. “ext-*”: Presence of selected extension I .$$- ,!2r 0$rv$r (! +'v$ (+$0$.. C+$*5)./ 0,0($" -$p$.-$.*)$0
  60. 60. I.0('&&)./, 2p-'()./ '.- "!v)./ !. how does Composer guarantee consistency
  61. 61. composer.json
  62. 62. “composer.json”: metadata and list of your dependencies. composer.json
  63. 63. “composer.json”: metadata and list of your dependencies. composer.lock composer.json
  64. 64. “composer.json”: metadata and list of your dependencies. “composer.lock”: existing dependencies and current commit hashes. composer.lock composer.json
  65. 65. composer.lock composer.json
  66. 66. update composer.lock composer.json
  67. 67. update install composer.lock composer.json
  68. 68. update install reads composer.lock composer.json
  69. 69. update install reads gets latest composer.lock composer.json
  70. 70. update install reads gets latest writes composer.lock composer.json
  71. 71. update install reads gets latest writes reads composer.lock composer.json
  72. 72. update install reads gets latest writes reads compares composer.lock composer.json
  73. 73. update install reads gets latest writes reads gets locked version compares composer.lock composer.json
  74. 74. K$$p (+$ ($'" !. (+$ 0'"$ p'/$ Commit you composer.lock file into the repository, and use composer install.
  75. 75. I’" -$v$&!p)./ ' &)br'r,, +$&p! how can composer spread my library around?
  76. 76. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", }
  77. 77. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", } “name”: this should be unique, pick a good one!
  78. 78. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", } “name”: this should be unique, pick a good one! “type”: will be used for more advanced “custom”installs
  79. 79. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", } “name”: this should be unique, pick a good one! “type”: will be used for more advanced “custom”installs “license”: very important!
  80. 80. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", } “name”: this should be unique, pick a good one! “type”: will be used for more advanced “custom”installs “license”: very important! “support”: point people the right way.
  81. 81. { "name": "vendor-namespace/package-name", "type": "symfony-bundle", "description": "A sample package for examples", "keywords": ["php", "package"], "homepage": "http://doh.ms", "license": "MIT", "support": { "email": "support@mylib.com", "issues": "http://issues.lib.com" } "target-dir": "/folder/to/install", } “name”: this should be unique, pick a good one! “type”: will be used for more advanced “custom”installs “license”: very important! “support”: point people the right way. “target-dir”: great for installing sub-dir splits repositories ex: Symfony Bundles: /Acme/Bundle/MyBundle
  82. 82. Q2)*5! I w'..' p'(*+ (+)0! B!!(0(r'pp)./ L)br'r, C!.(r)b2()!.
  83. 83. $ composer.phar create-project dms/dms --dev ~/dev/oss/dms Q2)*5! I w'..' p'(*+ (+)0! B!!(0(r'pp)./ L)br'r, C!.(r)b2()!.
  84. 84. $ composer.phar create-project dms/dms --dev ~/dev/oss/dms Q2)*5! I w'..' p'(*+ (+)0! B!!(0(r'pp)./ L)br'r, C!.(r)b2()!. gimme dev packages
  85. 85. $ composer.phar create-project dms/dms --dev ~/dev/oss/dms Q2)*5! I w'..' p'(*+ (+)0! B!!(0(r'pp)./ L)br'r, C!.(r)b2()!. gimme dev packages     "require-dev": {         "symfony/symfony": ">=2.1-dev",         "doctrine/orm": "dev-master"     },
  86. 86. $ composer.phar create-project dms/dms --dev ~/dev/oss/dms Q2)*5! I w'..' p'(*+ (+)0! B!!(0(r'pp)./ L)br'r, C!.(r)b2()!. gimme dev packages     "require-dev": {         "symfony/symfony": ">=2.1-dev",         "doctrine/orm": "dev-master"     }, “require-dev”: only needed if you are going to contribute/develop the library
  87. 87. T'/ ,!2r r$&$'0$0! use semver and always make tags for releases
  88. 88. T'/ ,!2r r$&$'0$0! use semver and always make tags for releases X.Y.Z
  89. 89. Up/r'-)./ (! ' M'$0(r!
  90. 90. B2( I .$$- ' 0p$*)6* v$r0)!. version modifiers to the rescue!
  91. 91. "acme/foo": "1.0.x-dev#3ebbe75"
  92. 92. "acme/foo": "1.0.x-dev#3ebbe75" “#<ref>”: Get this specific commit
  93. 93. "acme/foo": "1.0.x-dev#3ebbe75" "acme/foo": "@dev" "acme/foo": "1.0.*@beta" “#<ref>”: Get this specific commit
  94. 94. "acme/foo": "1.0.x-dev#3ebbe75" "acme/foo": "@dev" "acme/foo": "1.0.*@beta" “#<ref>”: Get this specific commit “@<state>”: Get a version outside your default stability
  95. 95. I .$$- (! 7$*2($ ' f$w 0*r)p(0 how to automate tasks with Composer
  96. 96.     "scripts": {         "post-install-cmd": [             "Sensio...ComposerScriptHandler::buildBootstrap",             "Sensio...ComposerScriptHandler::clearCache",             "Sensio...ComposerScriptHandler::installAssets",             "Sensio...ComposerScriptHandler::installRequirementsFile"         ],         "post-update-cmd": [             "Sensio...ComposerScriptHandler::buildBootstrap",             "Sensio...ComposerScriptHandler::clearCache",             "Sensio...ComposerScriptHandler::installAssets",             "Sensio...ComposerScriptHandler::installRequirementsFile"         ]     },
  97. 97.     "scripts": {         "post-install-cmd": [             "Sensio...ComposerScriptHandler::buildBootstrap",             "Sensio...ComposerScriptHandler::clearCache",             "Sensio...ComposerScriptHandler::installAssets",             "Sensio...ComposerScriptHandler::installRequirementsFile"         ],         "post-update-cmd": [             "Sensio...ComposerScriptHandler::buildBootstrap",             "Sensio...ComposerScriptHandler::clearCache",             "Sensio...ComposerScriptHandler::installAssets",             "Sensio...ComposerScriptHandler::installRequirementsFile"         ]     }, “scripts”: allows you to run scripts at given moments
  98. 98. C20(!" R$p#)(!r)$0 !r .! C!"p#$r, w+'( .!w? Injecting Composer into wild packages
  99. 99. “hero/superpackage”: “dev-master”
  100. 100. “hero/superpackage”: “dev-master”
  101. 101. “hero/superpackage”: “dev-master”
  102. 102. “hero/superpackage”: “dev-master”
  103. 103. “hero/superpackage”: “dev-master”     "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/hero-superpackage" }        ]
  104. 104. “hero/superpackage”: “dev-master”     "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/hero-superpackage" }        ] my fork
  105. 105. “hero/superpackage”: “dev-master”     "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/hero-superpackage" }        ] “repositories”: point to non-indexed, override existing or on-the-fly packages my fork
  106. 106. { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] } N!.-C!"p#$r P'*5'/$
  107. 107. { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] } “package”: on-the-fly package, injecting a composer.json N!.-C!"p#$r P'*5'/$
  108. 108. { "repositories": [ { "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "dist": { "url": "http://www.smarty.net/files/Smarty-3.1.7.zip", "type": "zip" }, "source": { "url": "http://smarty-php.googlecode.com/svn/", "type": "svn", "reference": "tags/Smarty_3_1_7/distribution/" } } } ] } SVN / Git “package”: on-the-fly package, injecting a composer.json N!.-C!"p#$r P'*5'/$
  109. 109. I .$$- (+)0 PEAR p'*5'/$... No Problem!
  110. 110. { "repositories": [ { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } }
  111. 111. { "repositories": [ { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } } “pear”: official PEAR and custom PEAR channels
  112. 112. { "repositories": [ { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } } “pear”: official PEAR and custom PEAR channels Remember the prefix!
  113. 113. { "repositories": [ { "type": "pear", "url": "http://pear2.php.net" } ], "require": { "pear-pear2.php.net/PEAR2_Text_Markdown": "*", "pear-pear2/PEAR2_HTTP_Request": "*" } } “pear”: official PEAR and custom PEAR channels Remember the prefix! Warning: PEAR causes a overhead of requests!!
  114. 114. 1.-)./ ,!2r (2.$
  115. 115. I .$$- ' &)br'r, (+'( -!$0.. Let me get that for you
  116. 116. http://packagist.org/
  117. 117. versions package info usage info
  118. 118. $ composer.phar search filter
  119. 119. dms/dms-filter-bundle : DMS Filter Bundle, makes Annotation based ... lexik/form-filter-bundle : This bundle aim to provide classes to build... rollerworks/recordfilter-bundle : Record search-filtering bundle for Symfony brikou/zend_filter : Zend Framework Filter Library ext-filter : The filter PHP extension dms/dms-filter : DMS Library, includes various bundles and ... shtumi/useful-bundle : Symfony ShtumiUsefulBundle $ composer.phar search filter
  120. 120. $ composer.phar show dms/dms-filter-bundle
  121. 121. name : dms/dms-filter-bundle descrip. : DMS Filter Bundle, makes Annotation based entity filtering available in Symfony keywords : symfony, bundle, filter, dms versions : dev-master, v1.1.1, v1.1, 1.0.2, 1.0.1, 1.0.0 type : symfony-bundle license : MIT source : [git] https://github.com/rdohms/DMSFilterBundle v1.1.1 dist : [zip] https://github.com/rdohms/DMSFilterBundle/zipball/ v1.1.1 v1.1.1 names : dms/dms-filter-bundle autoload psr-0 DMSBundleFilterBundle => . requires php >=5.3.2 dms/dms-filter >=1.0.2 $ composer.phar show dms/dms-filter-bundle
  122. 122. B2( ", r$p#)(!r, )0 pr)v'($! Get your own package repository
  123. 123. S'()0!
  124. 124. $ composer.phar create-project composer/satis R!""!#$ %!#r !w& S'$()
  125. 125. $ composer.phar create-project composer/satis $ vi packages.json { "name": "My Repository", "homepage": "http://packages.example.org", "repositories": [ { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" }, { "type": "vcs", "url": "http://svn.example.org/private/repo" }, { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" } ], "require-all": true } R!""!#$ %!#r !w& S'$()
  126. 126. $ composer.phar create-project composer/satis $ vi packages.json $ php bin/satis build config.json web/ { "name": "My Repository", "homepage": "http://packages.example.org", "repositories": [ { "type": "vcs", "url": "http://github.com/mycompany/privaterepo" }, { "type": "vcs", "url": "http://svn.example.org/private/repo" }, { "type": "vcs", "url": "http://github.com/mycompany/privaterepo2" } ], "require-all": true } R!""!#$ %!#r !w& S'$()
  127. 127. { "repositories": [ { "type": "composer", "url": "http://packages.yourdomain.net" } ], “require”: { “myvendor/mypackage”: “dev-master” } } U)(&* %!#r !w& S'$()
  128. 128. { "repositories": [ { "type": "composer", "url": "http://packages.yourdomain.net" } ], “require”: { “myvendor/mypackage”: “dev-master” } } U)(&* %!#r !w& S'$() “composer”: use this just like it was Packagist
  129. 129. W+$r$ 0+!2&- I /$( +$&p? http://getcomposer.org #composer on irc.freenode.org
  130. 130. %$ E&$v'(!r P)(*+ Dependency Manager, consistent versions, per-project Ev$r,-', *!"p#)./ install, update, lock and autoload Up/r'-)./ (! ' M'$0(r! post-install, overriding, PEAR integration, developer environment 1.-)./ ,!2r (2.$ Satis and Packagist
  131. 131. Q2$0()!.0? http://slides.doh.ms http://doh.ms @rdohms https://joind.in/8178

×