Composerthe right way
@rdohms
Rafael Dohms
photo: smileymanwithahat
Composer The Right Way
Composer The Right Way
photo: Rob Allen
photo: 18millionpixels
Library Publisher
photo: 18millionpixels
Library Publisher
Library Consumer
photo: 18millionpixels
Library Publisher
Library
Library Consumer
photo: 18millionpixels
Library Publisher
Library
Library Consumer
Packagist
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": {
"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.
___

~1.1
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.
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing psr/log (1.0.0)
Loading from cache
- Installing monolog/monolog (1.11.0)
Downloading: 100%
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
[...]
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
Writing lock file
Generating autoload files
___

~1.1
photo: 18millionpixels
composer
composercomposer.json!
composercomposer.json!
composer.lock!
composercomposer.json!
composer.lock!
discovery Packagist
"
composercomposer.json!
composer.lock!
discovery sourcePackagist
"
Repository
#
composercomposer.json!
composer.lock!
discovery source
installation
Packagist
"
Vendor

Folder
$
Repository
#
composercomposer.json!
composer.lock!
$ composer init
Library Publisher
$ composer init
Library Publisher
$ composer require <vendor>/<package>
Library Consumer
$ composer require monolog/monolog
Tip
$ composer require monolog/monolog
Tip
Using version ~1.11 for monolog/monolog
Release the @DOHMSRAKEN!!
photo by @rosstuck
$ composer require monolog/monolog --sort-packages
Tip
Library Publishers
Composer for
Library Publisher Unique vendor names
vendor / package
Library Publisher Unique vendor names
pick your own 

unique vendor
Library Publisher Unique vendor names
or join a collective
README!
CHANGELOG%
LICENSE&
Library Publisher What’s in your library?
README!
CHANGELOG%
LICENSE&
Library Publisher What’s in your library?
' What problem does it solve?
' Usage examples
' Install instructions
' How can I contribute?
README!
CHANGELOG%
LICENSE&
Library Publisher What’s in your library?
' List relevant changes
' Make BC breaks prominent
' Show examples of how to upgrade
' What problem does it solve?
' Usage examples
' Install instructions
' How can I contribute?
README!
CHANGELOG%
LICENSE&
Library Publisher What’s in your library?
' List relevant changes
' Make BC breaks prominent
' Show examples of how to upgrade
' Pick one that reflects your values
' choosealicense.com can help
' What problem does it solve?
' Usage examples
' Install instructions
' How can I contribute?
Library Publisher Semantic Versioning
1 . 2 3.major minor patch
Library Publisher Semantic Versioning
1 . 2 3.major minor patch
Bug Fixes
Library Publisher Semantic Versioning
1 . 2 3.major minor patch
New Features Bug Fixes
Library Publisher Semantic Versioning
1 . 2 3.major minor patch
API / BC
Breaks
New Features Bug Fixes
Library Publisher Tagging
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 “I'm out"
photo: jilliancorinne
Library Publisher “I'm out"
Library Publisher “I'm out"
Click here and provide another
Library Publisher “I'm out"
Library Publisher “I'm out"
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.3, <1.3
Library Publisher Pick a Version
~1.2.3
>=1.2.3, <1.3
Library Publisher Pick a Version
)
"require": {
"zendframework/zend-stdlib": “2.1.*”,
"zendframework/zend-servicemanager": "2.1.*",
},
“require-dev": {
“phpunit/phpunit": “~3.7”
}
Library Publisher Pick a Version
"require": {
"zendframework/zend-stdlib": “~2.3”,
"zendframework/zend-servicemanager": “~2.3",
},
“require-dev": {
“phpunit/phpunit": “~4”
}
3rd party library
Your application
"require": {
"zendframework/zend-stdlib": “2.1.*”,
"zendframework/zend-servicemanager": "2.1.*",
},
“require-dev": {
“phpunit/phpunit": “~3.7”
}
Library Publisher Pick a Version
"require": {
"zendframework/zend-stdlib": “~2.3”,
"zendframework/zend-servicemanager": “~2.3",
},
“require-dev": {
“phpunit/phpunit": “~4”
}
3rd party library
Your application
*
"require": {
"zendframework/zend-stdlib": “2.1.*”,
"zendframework/zend-servicemanager": "2.1.*",
},
“require-dev": {
“phpunit/phpunit": “~3.7”
}
Library Publisher Pick a Version
"require": {
"zendframework/zend-stdlib": “~2.3”,
"zendframework/zend-servicemanager": “~2.3",
},
“require-dev": {
“phpunit/phpunit": “~4”
}
3rd party library
Your application
*
"require": {
"zendframework/zend-stdlib": “2.1.*”,
"zendframework/zend-servicemanager": "2.1.*",
},
“require-dev": {
“phpunit/phpunit": “~3.7”
}
Library Publisher Pick a Version
"require": {
"zendframework/zend-stdlib": “~2.3”,
"zendframework/zend-servicemanager": “~2.3",
},
“require-dev": {
“phpunit/phpunit": “~4”
}
3rd party library
Your application
*
~2.1
Yo @rdohms, I’m
really happy for you and
I’m gonna let you finish, but
the tilde operator is
totally old news.
^the caret
Library Publisher Pick a Version
1.2.3
>=1.2.3, <2.0.0
Library Publisher Pick a Version
^
1.2.3
>=1.2.3, <2.0.0
Library Publisher Pick a Version
)
^
)
0.3.0
>=0.3.0, <0.4.0
Library Publisher Pick a Version
^
0.3.0
>=0.3.0, <0.4.0
Library Publisher Pick a Version
^
)
0.3.0
>=0.3.0, <0.4.0
Library Publisher Pick a Version
^
)
Major Version Zero
Library Consumers
Composer for
Library Consumer Install or update?
install or update?
Library Consumer Install or update?
Make sure you have
installed the last
updates from other
developers.
?
install updateor
Library Consumer Install or update?
Make sure you have
installed the last
updates from other
developers.
?
install updateor
Library Consumer Install or update?
Deploying a new
release of your
application to
production.
?
install updateor
Library Consumer Install or update?
Deploying a new
release of your
application to
production.
?
install updateor
Library Consumer Install or update?
Checked out a new
project and want to
start coding.
?
install updateor
Library Consumer Install or update?
Checked out a new
project and want to
start coding.
?
install updateor
Library Consumer Install or update?
Grab new versions for
the dependencies of
your project.
?
install updateor
Library Consumer Install or update?
Grab new versions for
the dependencies of
your project.
?
install updateor
Your application
$
Public
Repository
#
Library Consumer Install or update?
composer.lock!
composer install
composer update
Your application
$
Public
Repository
#
Library Consumer Install or update?
composer.lock!
read
composer install
composer update
Your application
$
Public
Repository
#
Library Consumer Install or update?
composer.lock!
read grab version
composer install
composer update
Your application
$
Public
Repository
#
Library Consumer Install or update?
composer.lock!
read grab version
check latest compatible release
composer install
composer update
Your application
$
Public
Repository
#
Library Consumer Install or update?
composer.lock!
read grab version
check latest compatible release
update
composer install
composer update
Library Consumer Install or update?
commit your lock file
Library Consumer Install or update?
$ composer update --lock
Tip
Pick the 

correct 

version
Library Consumer Version Selection
Library Consumer Version Selection
dev-master
Library Consumer Version Selection
Library Consumer Version Selection
Library Consumer Using forks
found a bug?
Library Consumer Using forks
$ composer install --prefer-source
Tip
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
rdohms/symfony
Library Consumer Using forks
symfony/symfony
rdohms/symfony
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rdohms/symfony"
}
]
Library Consumer Using forks
symfony/symfony
rdohms/symfony
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rdohms/symfony"
}
]
+
Library Consumer Using forks
Do not put
forked repositories

on packagist
,
Library Consumer Using forks
"require": {
"symfony/symfony": "dev-my-patch as 2.5.0"
}
Tip
Library Consumer Composer and deployments
Composer
and
production
Library Consumer Composer and deployments
Production
Server
-
Packagist
.
Library Consumer Composer and deployments
Production
Server
-
Packagist
.
/ Man in the middle
Library Consumer Composer and deployments
Build Server
0
Production
Server
-
"
Packagist
.
/ Man in the middle
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
,
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 Licensing
$ 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
Tip
Library Consumer Private Packages and Proxy
Satis and Toran
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
Library Consumer Private Packages and Proxy
toranproxy.com
private repos, automatic packagist proxy
and support composer development
Library Consumer Tooling
$ composer require jquery/jquery
How many of you?
Library Consumer Tooling
Library Consumer Tooling
Javascript only Developer
Library Consumer Tooling
3 my-js-library
4
Javascript only Developer
Library Consumer Tooling
3 my-js-library
! package.json
4
Javascript only Developer
Library Consumer Tooling
3 my-js-library
! package.json
! bower.json
4
Javascript only Developer
Library Consumer Tooling
3 my-js-library
! composer.json
! package.json
! bower.json
4
Javascript only Developer
Library Consumer Tooling
3 my-js-library
! composer.json
! package.json
! bower.json
! .gemspec
4
Javascript only Developer
Library Consumer Tooling
3 my-js-library
! composer.json
! package.json
! bower.json
! .gemspec
4
/
/
Library Consumer Tooling
Library Consumer Tooling
Right tool.

Right job.
Library Consumer One last thing
One last thing…
Library Consumer pickle!
Library Consumer pickle!
$ pickle install memcache
https://wiki.php.net/rfc/pickle
https://github.com/FriendsOfPHP/pickle
Thank you.
https://leanpub.com/
composer-cookbook
Thank you.any questions?
5 http://slides.doh.ms
6 http://doh.ms
7 @rdohms
https://leanpub.com/
composer-cookbook

More Related Content

PDF
Composer the right way - DPC15
PDF
Composer the right way - NomadPHP
PDF
Composer The Right Way #PHPjhb15
PDF
Composer the right way
PDF
Composer the Right Way - PHPBNL16
PDF
Composer the Right Way - PHPSRB16
PDF
Composer The Right Way - PHPUGMRN
PDF
Composer the Right Way - MM16NL
Composer the right way - DPC15
Composer the right way - NomadPHP
Composer The Right Way #PHPjhb15
Composer the right way
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPSRB16
Composer The Right Way - PHPUGMRN
Composer the Right Way - MM16NL

What's hot (20)

PDF
Composer The Right Way - 010PHP
PDF
Composer the right way [SweetlakePHP]
PDF
Composer for Busy Developers - php|tek13
PDF
Composer the right way - SunshinePHP
PDF
Dependency management with Composer
PDF
Dependency Management with Composer
PPTX
PHP Dependency Management with Composer
PDF
Create your own composer package
PPTX
Introduction to Makefile
PPTX
Php psr standard 2014 01-22
PDF
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
PPTX
Composer for Magento 1.x and Magento 2
PDF
Digital Fabrication Studio.02 _Information @ Aalto Media Factory
PPTX
Managing your Drupal project with Composer
PDF
Distributing UI Libraries: in a post Web-Component world
ODP
Packaging for the Maemo Platform
PPTX
Composer | PHP Dependency Manager
Composer The Right Way - 010PHP
Composer the right way [SweetlakePHP]
Composer for Busy Developers - php|tek13
Composer the right way - SunshinePHP
Dependency management with Composer
Dependency Management with Composer
PHP Dependency Management with Composer
Create your own composer package
Introduction to Makefile
Php psr standard 2014 01-22
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Composer for Magento 1.x and Magento 2
Digital Fabrication Studio.02 _Information @ Aalto Media Factory
Managing your Drupal project with Composer
Distributing UI Libraries: in a post Web-Component world
Packaging for the Maemo Platform
Composer | PHP Dependency Manager
Ad

Similar to Composer The Right Way (20)

KEY
Composer
PDF
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
PDF
Android Internal Library Management
PDF
Mastering composer
PPT
Managing Change
PDF
Dependency management in Magento with Composer
PDF
Php Dependency Management with Composer ZendCon 2016
PPT
CICON2010: Adam Griffiths - CodeIgniter 2
PPTX
Composer namespacing
PDF
Digital Fabrication Studio v.0.2: Information
PDF
DCEU 18: Dockerfile Best Practices
PDF
DockerCon EU 2018 - Dockerfile Best Practices
PDF
Deep Dive Java 17 Devoxx UK
PDF
Let the contribution begin (EST futures)
PDF
7 Tips on Getting Your Theme Approved the First Time
PDF
Composer Helpdesk
PDF
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
PDF
Let the contribution begin
PDF
Composer & Drupal
Composer
Internal Android Library Management (DroidCon SF 2016, Droidcon Italy 2016)
Android Internal Library Management
Mastering composer
Managing Change
Dependency management in Magento with Composer
Php Dependency Management with Composer ZendCon 2016
CICON2010: Adam Griffiths - CodeIgniter 2
Composer namespacing
Digital Fabrication Studio v.0.2: Information
DCEU 18: Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
Deep Dive Java 17 Devoxx UK
Let the contribution begin (EST futures)
7 Tips on Getting Your Theme Approved the First Time
Composer Helpdesk
DEF CON 27 - workshop - ISAAC EVANS - discover exploit and eradicate entire v...
Let the contribution begin
Composer & Drupal
Ad

More from Rafael Dohms (20)

PDF
The Individual Contributor Path - DPC2024
PDF
Application Metrics - IPC2023
PDF
How'd we get here? A guide to Architectural Decision Records
PDF
Architectural Decision Records - PHPConfBR
PDF
Application Metrics (with Prometheus examples)
PDF
Application metrics - Confoo 2019
PDF
Writing code you won’t hate tomorrow - PHPCE18
PDF
Application Metrics (with Prometheus examples) #PHPDD18
PDF
Application metrics with Prometheus - DPC18
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
PDF
Writing Code That Lasts - #Magento2Seminar, Utrecht
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
A Journey into your Lizard Brain - PHP Conference Brasil 2015
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
“Writing code that lasts” … or writing code you won’t hate tomorrow.
PDF
Journey into your Lizard Brain - PHPJHB15
PDF
A journey into your Lizard Brain
The Individual Contributor Path - DPC2024
Application Metrics - IPC2023
How'd we get here? A guide to Architectural Decision Records
Architectural Decision Records - PHPConfBR
Application Metrics (with Prometheus examples)
Application metrics - Confoo 2019
Writing code you won’t hate tomorrow - PHPCE18
Application Metrics (with Prometheus examples) #PHPDD18
Application metrics with Prometheus - DPC18
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
Writing Code That Lasts - #Magento2Seminar, Utrecht
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow.
A Journey into your Lizard Brain - PHP Conference Brasil 2015
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
Journey into your Lizard Brain - PHPJHB15
A journey into your Lizard Brain

Recently uploaded (20)

PDF
Five Habits of High-Impact Board Members
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPT
Geologic Time for studying geology for geologist
PDF
STKI Israel Market Study 2025 version august
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
CloudStack 4.21: First Look Webinar slides
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PPTX
Modernising the Digital Integration Hub
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPT
What is a Computer? Input Devices /output devices
PDF
Enhancing emotion recognition model for a student engagement use case through...
DOCX
search engine optimization ppt fir known well about this
PDF
A review of recent deep learning applications in wood surface defect identifi...
Five Habits of High-Impact Board Members
The influence of sentiment analysis in enhancing early warning system model f...
A comparative study of natural language inference in Swahili using monolingua...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Geologic Time for studying geology for geologist
STKI Israel Market Study 2025 version august
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
CloudStack 4.21: First Look Webinar slides
1 - Historical Antecedents, Social Consideration.pdf
Microsoft Excel 365/2024 Beginner's training
Taming the Chaos: How to Turn Unstructured Data into Decisions
Convolutional neural network based encoder-decoder for efficient real-time ob...
OpenACC and Open Hackathons Monthly Highlights July 2025
Modernising the Digital Integration Hub
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
What is a Computer? Input Devices /output devices
Enhancing emotion recognition model for a student engagement use case through...
search engine optimization ppt fir known well about this
A review of recent deep learning applications in wood surface defect identifi...

Composer The Right Way