Composer 
the right way 
Rafael Dohms 
@rdohms
photo: smileymanwithahat
photo: Rob Allen
The Composer Cookbook 
https://leanpub.com/composer-cookbook
photo: 18millionpixels
Library Publisher 
photo: 18millionpixels
Library Publisher 
Library Consumer 
photo: 18millionpixels
Library Publisher 
Library 
Library Consumer 
photo: 18millionpixels
Library Publisher 
Library 
Packagist 
Library Consumer 
photo: 18millionpixels
photo: 18millionpixels
{ 
"require": { 
"monolog/monolog": “2.0” 
} 
} 
photo: 18millionpixels
{ 
"require": { 
"monolog/monolog": “2.0” 
} 
} 
{ 
"name": “monolog/monolog” 
... 
} 
photo: 18millionpixels
{ 
"require": { 
"monolog/monolog": “2.0” 
} 
} 
{ 
"name": “monolog/monolog” 
... 
} 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 
! 
Problem 1 
- The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. 
! 
Potential causes: 
- A typo in the package name 
- The package is not available in a stable-enough version according to your minimum-stability setting 
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. 
! 
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. 
! 
Installation failed, reverting ./composer.json to its original content. 
photo: 18millionpixels
{ 
"require": { 
___ 
~1.1 
"monolog/monolog": “2.0” 
} 
} 
{ 
"name": “monolog/monolog” 
... 
} 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 
! 
Problem 1 
- The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. 
! 
Potential causes: 
- A typo in the package name 
- The package is not available in a stable-enough version according to your minimum-stability setting 
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. 
! 
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. 
! 
Installation failed, reverting ./composer.json to its original content. 
photo: 18millionpixels
{ 
"require": { 
___ 
~1.1 
"monolog/monolog": “2.0” 
} 
} 
{ 
"name": “monolog/monolog” 
... 
} 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 
! 
Problem 1 
- Installing psr/log (1.0.0) 
Loading from cache 
! 
- Installing monolog/monolog (1.11.0) 
- The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. 
! 
Downloading: 100% 
Potential causes: 
- A typo in the package name 
- The package is not available in a stable-enough version according to your minimum-stability setting 
! 
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) 
[...] 
monolog/see <https://monolog groups.suggests google.installing com/d/ext-topic/mongo composer-(Allow dev/_sending g3ASeIFlrc/log messages discussion> to a for MongoDB more server) 
details. 
monolog/! 
monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) 
monolog/Read <http://monolog getcomposer.suggests org/installing doc/articles/rollbar/troubleshooting.rollbar (Allow md> sending for further log messages common to problems. 
Rollbar) 
! 
Writing lock file 
Installation Generating autoload failed, files 
reverting ./composer.json to its original content. 
photo: 18millionpixels
composer
! composer.json composer
! composer.json composer 
! composer.lock
! composer.json composer 
! composer.lock
discovery Packagist 
" 
! composer.json composer 
! composer.lock
discovery Packagist source 
" 
Repository 
# 
! composer.json composer 
! composer.lock
discovery source 
installation 
Packagist 
" 
Vendor 
Folder 
$ 
Repository 
# 
! composer.json composer 
! composer.lock
Library Publisher 
$ composer init
Library Publisher 
$ composer init 
Library Consumer 
$ composer require <vendor>/<package>
Tip 
$ composer require monolog/monolog 
Using version ~1.11 for monolog/monolog
Composer for 
Library Publishers
vendor / package 
Library Publisher Unique vendor names
pick your own 
unique vendor 
Library Publisher Unique vendor names
or join a collective 
Library Publisher Unique vendor names
! README 
% CHANGELOG 
& LICENSE 
Library Publisher What’s in your library?
! README 
% CHANGELOG 
& LICENSE 
' What problem does it solve? 
' Usage examples 
' Install instructions 
' How can I contribute? 
Library Publisher What’s in your library?
! README 
% CHANGELOG 
& LICENSE 
' What problem does it solve? 
' Usage examples 
' Install instructions 
' How can I contribute? 
' List relevant changes 
' Make BC breaks prominent 
' Show examples of how to upgrade 
Library Publisher What’s in your library?
! README 
% CHANGELOG 
& LICENSE 
' What problem does it solve? 
' Usage examples 
' Install instructions 
' How can I contribute? 
' List relevant changes 
' Make BC breaks prominent 
' Show examples of how to upgrade 
' Pick one that reflects your values 
' choosealicense.com can help 
Library Publisher What’s in your library?
1 . 2 . 3 
major minor patch 
Library Publisher Semantic Versioning
1 . 2 . 3 
major minor patch 
Library Publisher Semantic Versioning 
Bug Fixes
New Features Bug Fixes 
1 . 2 . 3 
major minor patch 
Library Publisher Semantic Versioning
API / BC Breaks New Features Bug Fixes 
1 . 2 . 3 
major minor patch 
Library Publisher Semantic Versioning
Tag it and Bag it 
Library Publisher Tagging
# Simple Tag 
$ git tag v1.2.3 
! 
! 
! 
# Annotated Tag 
$ git tag -a v1.2.3 -m “Description of Release" 
Library Publisher Tagging
Library Publisher “I'm out" 
photo: jilliancorinne
Library Publisher “I'm out"
Click here and provide another 
Library Publisher “I'm out"
Library Publisher “I'm out"
Library Publisher “I'm out" 
coming 
soon
Pick the 
correct 
version 
Library Publisher Pick a Version
* the asterisk 
Library Publisher Pick a Version
* the asterisk ○ 
Library Publisher Pick a Version
~ the tilde 
Library Publisher Pick a Version
~1.2 
>=1.2.0, <2.0.0 
Library Publisher Pick a Version
~1.2 
>=1.2.0, <2.0.0 
Library Publisher Pick a Version 
)
~1.2.3 
>=1.2.0, <1.3 
Library Publisher Pick a Version
~1.2.3 
>=1.2.0, <1.3 
Library Publisher Pick a Version 
)
3rd party library 
"require": { 
"zendframework/zend-stdlib": “2.1.*”, 
"zendframework/zend-servicemanager": "2.1.*", 
}, 
! 
“require-dev": { 
“phpunit/phpunit": “~3.7” 
} 
Your application 
"require": { 
"zendframework/zend-stdlib": “~2.3”, 
"zendframework/zend-servicemanager": “~2.3", 
}, 
! 
“require-dev": { 
“phpunit/phpunit": “~4” 
} 
Library Publisher Pick a Version
3rd party library 
"require": { 
"zendframework/zend-stdlib": “2.1.*”, 
"zendframework/zend-servicemanager": "2.1.*", 
}, 
! 
“require-dev": { 
* 
“phpunit/phpunit": “~3.7” 
} 
Your application 
"require": { 
"zendframework/zend-stdlib": “~2.3”, 
"zendframework/zend-servicemanager": “~2.3", 
}, 
! 
“require-dev": { 
“phpunit/phpunit": “~4” 
} 
Library Publisher Pick a Version
3rd party library 
"require": { 
"zendframework/zend-stdlib": “2.1.*”, 
"zendframework/zend-servicemanager": "2.1.*", 
}, 
! 
“require-dev": { 
* 
“phpunit/phpunit": “~3.7” 
} 
Your application 
"require": { 
"zendframework/zend-stdlib": “~2.3”, 
"zendframework/zend-servicemanager": “~2.3", 
}, 
! 
“require-dev": { 
“phpunit/phpunit": “~4” 
} 
Library Publisher Pick a Version
3rd party library 
"require": { 
"zendframework/zend-stdlib": “2.1.*”, 
"zendframework/zend-servicemanager": "2.1.*", 
}, 
! 
“require-dev": { 
* 
“phpunit/phpunit": “~3.7” 
} 
Your application 
"require": { 
"zendframework/zend-stdlib": “~2.3”, 
"zendframework/zend-servicemanager": “~2.3", 
}, 
! 
“require-dev": { 
“phpunit/phpunit": “~4” 
} 
Library Publisher Pick a Version 
~2.1
Composer for 
Library Consumers
install or update? 
Library Consumer Install or update?
Make sure you have 
installed the last 
updates from other 
developers. 
? 
install or update 
Library Consumer Install or update?
Make sure you have 
installed the last 
updates from other 
developers. 
? 
install or update 
Library Consumer Install or update?
Deploying a new 
release of your 
application to 
production. 
? 
install or update 
Library Consumer Install or update?
Deploying a new 
release of your 
application to 
production. 
? 
install or update 
Library Consumer Install or update?
Checked out a new 
project and want to 
start coding. 
? 
install or update 
Library Consumer Install or update?
Checked out a new 
project and want to 
start coding. 
? 
install or update 
Library Consumer Install or update?
Grab new versions for 
the dependencies of 
your project. 
? 
install or update 
Library Consumer Install or update?
Grab new versions for 
the dependencies of 
your project. 
? 
install or update 
Library Consumer Install or update?
Your application 
$ 
Public 
Repository 
# 
! composer.lock 
composer install 
composer update 
Library Consumer Install or update?
Your application 
$ 
Public 
Repository 
# 
! composer.lock 
read 
composer install 
composer update 
Library Consumer Install or update?
Your application 
$ 
read grab version 
Public 
Repository 
# 
! composer.lock 
composer install 
composer update 
Library Consumer Install or update?
Your application 
$ 
read grab version 
Public 
Repository 
# 
! composer.lock 
check latest compatible release 
composer install 
composer update 
Library Consumer Install or update?
Your application 
$ 
read grab version 
Public 
Repository 
# 
! composer.lock 
check latest compatible release 
Library Consumer Install or update? 
update 
composer install 
composer update
commit your lock file 
Library Consumer Install or update?
Tip 
$ composer update --lock 
Library Consumer Install or update?
Pick the 
correct 
version 
Library Consumer Version Selection
dev-master 
Library Consumer Version Selection
Library Consumer Version Selection
Library Consumer Version Selection
found a bug? 
Library Consumer Using forks
Tip 
$ composer install --prefer-source 
Library Consumer Using forks
Library Consumer Using forks
patch it, 
Library Consumer Using forks
patch it, 
fork it, 
Library Consumer Using forks
patch it, 
fork it, 
push it… 
Library Consumer Using forks
patch it, 
fork it, 
push it… 
wait for it. 
Library Consumer Using forks
patch it, 
fork it, 
push it… 
wait for it. 
Library Consumer Using forks
symfony/symfony 
Library Consumer Using forks
symfony/symfony 
Library Consumer Using forks 
rdohms/symfony
symfony/symfony 
Library Consumer Using forks 
rdohms/symfony 
"repositories": [ 
{ 
"type": "vcs", 
"url": "https://github.com/rdohms/symfony" 
} 
]
symfony/symfony 
Library Consumer Using forks 
rdohms/symfony 
"repositories": [ 
{ 
"type": "vcs", 
"url": "https://github.com/rdohms/symfony" 
} 
] 
+
Tip 
$ composer show -v symfony/symfony 
Library Consumer Using forks
Do not put 
forked repositories 
on packagist 
, 
Library Consumer Using forks
Tip 
"require": { 
"symfony/symfony": "dev-my-patch as 2.5.0" 
} 
Library Consumer Using forks
Composer 
and 
production 
Library Consumer Composer and deployments
Packagist 
. 
Production 
Server 
- 
Library Consumer Composer and deployments
Packagist 
. 
/ Man in the middle 
Production 
Server 
- 
Library Consumer Composer and deployments
Build Server 
0 
Library Consumer Composer and deployments 
Production 
Server 
- 
" 
Packagist 
. 
/ Man in the middle
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
1 Install same versions 
1 Uses information defined in the composer.lock file 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
1 Downloads distribution packages 
1 Can use local cache for previously downloaded 
1 No git required 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
1 Avoids download unnecessary developer libraries 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
Library Consumer Composer and deployments
, 
$ composer install --prefer-dist --no-dev —optimize-autoloader 
1 Generates classmap from PSR-0/4 autoloaders 
1 Speeds up autoloading 
Library Consumer Composer and deployments
Tip 
$ composer licenses 
! 
Name: __root__ 
Version: 1.0.0 
Licenses: none 
Dependencies: 
! 
doctrine/annotations v1.2.1 MIT 
doctrine/cache v1.3.1 MIT 
doctrine/collections v1.2 MIT 
doctrine/common v2.4.2 MIT 
doctrine/inflector v1.0 MIT 
doctrine/lexer v1.0 MIT 
psr/log 1.0.0 MIT 
symfony/symfony v2.5.6 MIT 
twig/twig v1.16.2 BSD-3-Clause 
Library Consumer Licensing
Satis and Toran 
Library Consumer Private Packages and Proxy
composer Packagist 
" 
Your application 
$ 
Public 
Repository 
# 
Library Consumer Private Packages and Proxy
composer 
Packagist 
" 
Your application 
$ 
Public 
Repository 
# 
Satis / Toran 
" 
Private 
Repository 
2 
proxy 
Library Consumer Private Packages and Proxy
toranproxy.com 
private repos, automatic packagist proxy 
and support composer development 
Library Consumer Private Packages and Proxy
How many of you? 
$ composer require jquery/jquery 
Library Consumer Tooling
Library Consumer Tooling
Library Consumer Tooling
Javascript only Developer 
3 my-js-library 
4 
Library Consumer Tooling
Javascript only Developer 
3 my-js-library 
Library Consumer Tooling 
! package.json 
4
Javascript only Developer 
3 my-js-library 
Library Consumer Tooling 
! package.json 
! bower.json 
4
Javascript only Developer 
3 my-js-library 
Library Consumer Tooling 
! package.json 
! bower.json 
! composer.json 
4
Javascript only Developer 
3 my-js-library 
Library Consumer Tooling 
! package.json 
! bower.json 
! composer.json 
! .gemspec 
4
Javascript only Developer 
3 my-js-library 
Library Consumer Tooling 
! package.json 
! bower.json 
! composer.json 
! .gemspec 
4 
/ 
/
Library Consumer Tooling
Right tool. 
Right job. 
Library Consumer Tooling
One last thing… 
Library Consumer One last thing
Library Consumer pickle!
$ pickle install memcache 
https://wiki.php.net/rfc/pickle 
https://github.com/FriendsOfPHP/pickle 
Library Consumer pickle!
https://joind.in/11878 
Thank you.
https://joind.in/11878 
Thank you. any questions? 
7 @rdohms 
6 http://doh.ms 
5 http://slides.doh.ms

Composer the right way

  • 1.
    Composer the rightway Rafael Dohms @rdohms
  • 2.
  • 5.
  • 6.
    The Composer Cookbook https://leanpub.com/composer-cookbook
  • 7.
  • 8.
    Library Publisher photo:18millionpixels
  • 9.
    Library Publisher LibraryConsumer photo: 18millionpixels
  • 10.
    Library Publisher Library Library Consumer photo: 18millionpixels
  • 11.
    Library Publisher Library Packagist Library Consumer photo: 18millionpixels
  • 12.
  • 13.
    { "require": { "monolog/monolog": “2.0” } } photo: 18millionpixels
  • 14.
    { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } photo: 18millionpixels
  • 15.
    { "require": { "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. ! Problem 1 - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. ! Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. ! Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. ! Installation failed, reverting ./composer.json to its original content. photo: 18millionpixels
  • 16.
    { "require": { ___ ~1.1 "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. ! Problem 1 - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. ! Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. ! Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. ! Installation failed, reverting ./composer.json to its original content. photo: 18millionpixels
  • 17.
    { "require": { ___ ~1.1 "monolog/monolog": “2.0” } } { "name": “monolog/monolog” ... } ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. ! Problem 1 - Installing psr/log (1.0.0) Loading from cache ! - Installing monolog/monolog (1.11.0) - The requested package monolog/monolog could not be found in any version, there may be a typo in the package name. ! Downloading: 100% Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting ! monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) [...] monolog/see <https://monolog groups.suggests google.installing com/d/ext-topic/mongo composer-(Allow dev/_sending g3ASeIFlrc/log messages discussion> to a for MongoDB more server) details. monolog/! monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) monolog/Read <http://monolog getcomposer.suggests org/installing doc/articles/rollbar/troubleshooting.rollbar (Allow md> sending for further log messages common to problems. Rollbar) ! Writing lock file Installation Generating autoload failed, files reverting ./composer.json to its original content. photo: 18millionpixels
  • 18.
  • 19.
  • 20.
    ! composer.json composer ! composer.lock
  • 21.
    ! composer.json composer ! composer.lock
  • 22.
    discovery Packagist " ! composer.json composer ! composer.lock
  • 23.
    discovery Packagist source " Repository # ! composer.json composer ! composer.lock
  • 24.
    discovery source installation Packagist " Vendor Folder $ Repository # ! composer.json composer ! composer.lock
  • 25.
    Library Publisher $composer init
  • 26.
    Library Publisher $composer init Library Consumer $ composer require <vendor>/<package>
  • 27.
    Tip $ composerrequire monolog/monolog Using version ~1.11 for monolog/monolog
  • 28.
  • 29.
    vendor / package Library Publisher Unique vendor names
  • 30.
    pick your own unique vendor Library Publisher Unique vendor names
  • 31.
    or join acollective Library Publisher Unique vendor names
  • 32.
    ! README %CHANGELOG & LICENSE Library Publisher What’s in your library?
  • 33.
    ! README %CHANGELOG & LICENSE ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute? Library Publisher What’s in your library?
  • 34.
    ! README %CHANGELOG & LICENSE ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute? ' List relevant changes ' Make BC breaks prominent ' Show examples of how to upgrade Library Publisher What’s in your library?
  • 35.
    ! README %CHANGELOG & LICENSE ' What problem does it solve? ' Usage examples ' Install instructions ' How can I contribute? ' List relevant changes ' Make BC breaks prominent ' Show examples of how to upgrade ' Pick one that reflects your values ' choosealicense.com can help Library Publisher What’s in your library?
  • 36.
    1 . 2. 3 major minor patch Library Publisher Semantic Versioning
  • 37.
    1 . 2. 3 major minor patch Library Publisher Semantic Versioning Bug Fixes
  • 38.
    New Features BugFixes 1 . 2 . 3 major minor patch Library Publisher Semantic Versioning
  • 39.
    API / BCBreaks New Features Bug Fixes 1 . 2 . 3 major minor patch Library Publisher Semantic Versioning
  • 40.
    Tag it andBag it Library Publisher Tagging
  • 41.
    # Simple Tag $ git tag v1.2.3 ! ! ! # Annotated Tag $ git tag -a v1.2.3 -m “Description of Release" Library Publisher Tagging
  • 42.
    Library Publisher “I'mout" photo: jilliancorinne
  • 43.
  • 44.
    Click here andprovide another Library Publisher “I'm out"
  • 45.
  • 46.
    Library Publisher “I'mout" coming soon
  • 47.
    Pick the correct version Library Publisher Pick a Version
  • 48.
    * the asterisk Library Publisher Pick a Version
  • 49.
    * the asterisk○ Library Publisher Pick a Version
  • 50.
    ~ the tilde Library Publisher Pick a Version
  • 51.
    ~1.2 >=1.2.0, <2.0.0 Library Publisher Pick a Version
  • 52.
    ~1.2 >=1.2.0, <2.0.0 Library Publisher Pick a Version )
  • 53.
    ~1.2.3 >=1.2.0, <1.3 Library Publisher Pick a Version
  • 54.
    ~1.2.3 >=1.2.0, <1.3 Library Publisher Pick a Version )
  • 55.
    3rd party library "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, ! “require-dev": { “phpunit/phpunit": “~3.7” } Your application "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, ! “require-dev": { “phpunit/phpunit": “~4” } Library Publisher Pick a Version
  • 56.
    3rd party library "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, ! “require-dev": { * “phpunit/phpunit": “~3.7” } Your application "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, ! “require-dev": { “phpunit/phpunit": “~4” } Library Publisher Pick a Version
  • 57.
    3rd party library "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, ! “require-dev": { * “phpunit/phpunit": “~3.7” } Your application "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, ! “require-dev": { “phpunit/phpunit": “~4” } Library Publisher Pick a Version
  • 58.
    3rd party library "require": { "zendframework/zend-stdlib": “2.1.*”, "zendframework/zend-servicemanager": "2.1.*", }, ! “require-dev": { * “phpunit/phpunit": “~3.7” } Your application "require": { "zendframework/zend-stdlib": “~2.3”, "zendframework/zend-servicemanager": “~2.3", }, ! “require-dev": { “phpunit/phpunit": “~4” } Library Publisher Pick a Version ~2.1
  • 59.
  • 60.
    install or update? Library Consumer Install or update?
  • 61.
    Make sure youhave installed the last updates from other developers. ? install or update Library Consumer Install or update?
  • 62.
    Make sure youhave installed the last updates from other developers. ? install or update Library Consumer Install or update?
  • 63.
    Deploying a new release of your application to production. ? install or update Library Consumer Install or update?
  • 64.
    Deploying a new release of your application to production. ? install or update Library Consumer Install or update?
  • 65.
    Checked out anew project and want to start coding. ? install or update Library Consumer Install or update?
  • 66.
    Checked out anew project and want to start coding. ? install or update Library Consumer Install or update?
  • 67.
    Grab new versionsfor the dependencies of your project. ? install or update Library Consumer Install or update?
  • 68.
    Grab new versionsfor the dependencies of your project. ? install or update Library Consumer Install or update?
  • 69.
    Your application $ Public Repository # ! composer.lock composer install composer update Library Consumer Install or update?
  • 70.
    Your application $ Public Repository # ! composer.lock read composer install composer update Library Consumer Install or update?
  • 71.
    Your application $ read grab version Public Repository # ! composer.lock composer install composer update Library Consumer Install or update?
  • 72.
    Your application $ read grab version Public Repository # ! composer.lock check latest compatible release composer install composer update Library Consumer Install or update?
  • 73.
    Your application $ read grab version Public Repository # ! composer.lock check latest compatible release Library Consumer Install or update? update composer install composer update
  • 74.
    commit your lockfile Library Consumer Install or update?
  • 75.
    Tip $ composerupdate --lock Library Consumer Install or update?
  • 76.
    Pick the correct version Library Consumer Version Selection
  • 77.
    dev-master Library ConsumerVersion Selection
  • 78.
  • 79.
  • 80.
    found a bug? Library Consumer Using forks
  • 81.
    Tip $ composerinstall --prefer-source Library Consumer Using forks
  • 82.
  • 83.
    patch it, LibraryConsumer Using forks
  • 84.
    patch it, forkit, Library Consumer Using forks
  • 85.
    patch it, forkit, push it… Library Consumer Using forks
  • 86.
    patch it, forkit, push it… wait for it. Library Consumer Using forks
  • 87.
    patch it, forkit, push it… wait for it. Library Consumer Using forks
  • 88.
  • 89.
    symfony/symfony Library ConsumerUsing forks rdohms/symfony
  • 90.
    symfony/symfony Library ConsumerUsing forks rdohms/symfony "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/symfony" } ]
  • 91.
    symfony/symfony Library ConsumerUsing forks rdohms/symfony "repositories": [ { "type": "vcs", "url": "https://github.com/rdohms/symfony" } ] +
  • 92.
    Tip $ composershow -v symfony/symfony Library Consumer Using forks
  • 93.
    Do not put forked repositories on packagist , Library Consumer Using forks
  • 94.
    Tip "require": { "symfony/symfony": "dev-my-patch as 2.5.0" } Library Consumer Using forks
  • 95.
    Composer and production Library Consumer Composer and deployments
  • 96.
    Packagist . Production Server - Library Consumer Composer and deployments
  • 97.
    Packagist . /Man in the middle Production Server - Library Consumer Composer and deployments
  • 98.
    Build Server 0 Library Consumer Composer and deployments Production Server - " Packagist . / Man in the middle
  • 99.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader Library Consumer Composer and deployments
  • 100.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader Library Consumer Composer and deployments
  • 101.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader 1 Install same versions 1 Uses information defined in the composer.lock file Library Consumer Composer and deployments
  • 102.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader Library Consumer Composer and deployments
  • 103.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader 1 Downloads distribution packages 1 Can use local cache for previously downloaded 1 No git required Library Consumer Composer and deployments
  • 104.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader Library Consumer Composer and deployments
  • 105.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader 1 Avoids download unnecessary developer libraries Library Consumer Composer and deployments
  • 106.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader Library Consumer Composer and deployments
  • 107.
    , $ composerinstall --prefer-dist --no-dev —optimize-autoloader 1 Generates classmap from PSR-0/4 autoloaders 1 Speeds up autoloading Library Consumer Composer and deployments
  • 108.
    Tip $ composerlicenses ! Name: __root__ Version: 1.0.0 Licenses: none Dependencies: ! doctrine/annotations v1.2.1 MIT doctrine/cache v1.3.1 MIT doctrine/collections v1.2 MIT doctrine/common v2.4.2 MIT doctrine/inflector v1.0 MIT doctrine/lexer v1.0 MIT psr/log 1.0.0 MIT symfony/symfony v2.5.6 MIT twig/twig v1.16.2 BSD-3-Clause Library Consumer Licensing
  • 109.
    Satis and Toran Library Consumer Private Packages and Proxy
  • 110.
    composer Packagist " Your application $ Public Repository # Library Consumer Private Packages and Proxy
  • 111.
    composer Packagist " Your application $ Public Repository # Satis / Toran " Private Repository 2 proxy Library Consumer Private Packages and Proxy
  • 112.
    toranproxy.com private repos,automatic packagist proxy and support composer development Library Consumer Private Packages and Proxy
  • 113.
    How many ofyou? $ composer require jquery/jquery Library Consumer Tooling
  • 114.
  • 115.
  • 116.
    Javascript only Developer 3 my-js-library 4 Library Consumer Tooling
  • 117.
    Javascript only Developer 3 my-js-library Library Consumer Tooling ! package.json 4
  • 118.
    Javascript only Developer 3 my-js-library Library Consumer Tooling ! package.json ! bower.json 4
  • 119.
    Javascript only Developer 3 my-js-library Library Consumer Tooling ! package.json ! bower.json ! composer.json 4
  • 120.
    Javascript only Developer 3 my-js-library Library Consumer Tooling ! package.json ! bower.json ! composer.json ! .gemspec 4
  • 121.
    Javascript only Developer 3 my-js-library Library Consumer Tooling ! package.json ! bower.json ! composer.json ! .gemspec 4 / /
  • 122.
  • 123.
    Right tool. Rightjob. Library Consumer Tooling
  • 124.
    One last thing… Library Consumer One last thing
  • 125.
  • 126.
    $ pickle installmemcache https://wiki.php.net/rfc/pickle https://github.com/FriendsOfPHP/pickle Library Consumer pickle!
  • 127.
  • 128.
    https://joind.in/11878 Thank you.any questions? 7 @rdohms 6 http://doh.ms 5 http://slides.doh.ms