SlideShare a Scribd company logo
C!"p#$rPutting your dependencies on the score
Rafael Dohms / @rdohms
photocredit:EliWhite
Evangelist, Speaker and
Contributor.
Developer at WEBclusive.
Enabler at AmsterdamPHP.
Rafael Dohms
@rdohms
photocredit:EliWhite
Evangelist, Speaker and
Contributor.
Developer at WEBclusive.
Enabler at AmsterdamPHP.
Rafael Dohms
@rdohms
%$ 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
%$ E&$v'(!r P)(*+
per project system wide
central repository
open acceptance
spread out channels
strict standards
I need my team and my deployments to
use consistent versions of the
dependencies of my project
The Evolution of Vendor Management
copy & paste
copy & paste
PEAR
copy & paste
SVN Externals
PEAR
copy & paste
SVN Externals
Git Submodules
PEAR
copy & paste
Symfony2
vendor script
SVN Externals
Git Submodules
PEAR
copy & paste
Symfony2
vendor script
SVN Externals
Git Submodules
PEAR
Composer!
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
Ev$r,-', C!"p#)./
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
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:
I.0('&&)./ C!"p#$r
I.0('&&)./ C!"p#$r
$ composer.phar --version
Composer version 7073d38
I.0('&&)./ C!"p#$r
$ composer.phar --version
Composer version 7073d38
php
K$$p )( 2p-'($-!
K$$p )( 2p-'($-!
$ composer.phar self-update
Updating to version 7073d38.
Downloading: 100%
I’" b2)&-)./ ' Pr!4$*(
How can composer manage your dependencies
C!"p#$r 101
G$(()./ (+$ -$p$.-$.*)$0
C!"p#$r 101
G$(()./ (+$ -$p$.-$.*)$0
$ cd ~/dev/myproject
C!"p#$r 101
G$(()./ (+$ -$p$.-$.*)$0
$ cd ~/dev/myproject
$ vim composer.json
{
"require": {
"silex/silex": "~1.0"
}
}
C!"p#$r 101
G$(()./ (+$ -$p$.-$.*)$0
$ cd ~/dev/myproject
$ vim composer.json
{
"require": {
"silex/silex": "~1.0"
}
}
put this in your project root
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
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
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
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
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
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
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
“~1.0”
V$r0)!.)./
G$( (+$ -!(0 ). ' r!w
“>=1.0”
“>=1.0, <=1.1”
“1.0.*”
“~1.0”
V$r0)!.)./
G$( (+$ -!(0 ). ' r!w
“>=1.0”
“>=1.0, <=1.1”
“1.0.*”
>=1.0, <2.0: BC Compatible releases
V$r0)!.)./: D$v
G$(()./ 0('b&$ !r -$v v$r0)!.0
V$r0)!.)./: D$v
G$(()./ 0('b&$ !r -$v v$r0)!.0
“minimum-stability”: “stable”
V$r0)!.)./: D$v
G$(()./ 0('b&$ !r -$v v$r0)!.0
“minimum-stability”: “stable”
No dev versions in dependency tree
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”
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
Q2)*5! I +'v$ '. )-$'!
B!#(r'pp)./ Pr!4$*(0
Q2)*5! I +'v$ '. )-$'!
B!#(r'pp)./ Pr!4$*(0
$ composer.phar create-project fabpot/silex-skeleton ~/dev/myproject
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
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/
A--)./ .$w R$q2)r$"$.(0
$ composer.phar require symfony/yaml=~2.1.0
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
H!w -! I 6.-/&!'- (+$ 6&$0?
PSR-0 and the modern autoloader
Composer generates an
autoload file for all your
dependencies
Composer generates an
autoload file for all your
dependencies
vendor/autoload.php
"autoload": {
    "psr-0": { "MyNamespace": "<root>" },
"classmap": ["src/", "lib/", "Something.php"],
"files": ["src/MyLibrary/functions.php"]
},
"autoload": {
    "psr-0": { "MyNamespace": "<root>" },
"classmap": ["src/", "lib/", "Something.php"],
"files": ["src/MyLibrary/functions.php"]
},
“autoload”: describes the autoloading needed for your library
"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
"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
"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
I .$$- ,!2r 0$rv$r (! +'v$ (+$0$..
C+$*5)./ 0,0($" -$p$.-$.*)$0
{
"require": {
"php": ">=5.3.3",
"ext-ldap": "*"
}
}
I .$$- ,!2r 0$rv$r (! +'v$ (+$0$..
C+$*5)./ 0,0($" -$p$.-$.*)$0
{
"require": {
"php": ">=5.3.3",
"ext-ldap": "*"
}
}
“php”: PHP version.
I .$$- ,!2r 0$rv$r (! +'v$ (+$0$..
C+$*5)./ 0,0($" -$p$.-$.*)$0
{
"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
I’" 0*'r$- !f @/r"p7r!/r'""$r
.. 0! I wr)($ ($0(0
    "require-dev": {
        "phpunit/phpunit": "~3.7"
    },
I’" 0*'r$- !f @/r"p7r!/r'""$r
.. 0! I wr)($ ($0(0
    "require-dev": {
        "phpunit/phpunit": "~3.7"
    },
“require-dev”: only needed if you are going to
contribute/develop the library or app
I’" 0*'r$- !f @/r"p7r!/r'""$r
.. 0! I wr)($ ($0(0
    "require-dev": {
        "phpunit/phpunit": "~3.7"
    },
“require-dev”: only needed if you are going to
contribute/develop the library or app
$ composer.phar require --dev phpunit/phpunit: ~3.7
I’" 0*'r$- !f @/r"p7r!/r'""$r
.. 0! I wr)($ ($0(0
    "require-dev": {
        "phpunit/phpunit": "~3.7"
    },
“require-dev”: only needed if you are going to
contribute/develop the library or app
$ composer.phar require --dev phpunit/phpunit: ~3.7
I’" 0*'r$- !f @/r"p7r!/r'""$r
.. 0! I wr)($ ($0(0
only required in development
I.0('&&)./, 2p-'()./ '.- "!v)./ !.
how does Composer guarantee consistency
composer.json
“composer.json”: metadata and list of your
dependencies.
composer.json
“composer.json”: metadata and list of your
dependencies.
composer.lock
composer.json
“composer.json”: metadata and list of your
dependencies.
“composer.lock”: existing dependencies and
current commit hashes.
composer.lock
composer.json
composer.lock
composer.json
update
composer.lock
composer.json
update install
composer.lock
composer.json
update install
reads
composer.lock
composer.json
update install
reads
gets latest
composer.lock
composer.json
update install
reads
gets latest
writes
composer.lock
composer.json
update install
reads
gets latest
writes
reads
composer.lock
composer.json
update install
reads
gets latest
writes
reads
compares
composer.lock
composer.json
update install
reads
gets latest
writes
reads
gets locked version
compares
composer.lock
composer.json
K$$p (+$ ($'" !. (+$ 0'"$ p'/$
Commit you composer.lock file
into the repository, and use
composer install.
D$p&!,)./ (! Pr!-2*()!.?
D$p&!,)./ (! Pr!-2*()!.?
--no-dev
D$p&!,)./ (! Pr!-2*()!.?
--no-dev
--prefer-dist
D$p&!,)./ (! Pr!-2*()!.?
--no-dev
--prefer-dist
--optimize-autoloader
I’" -$v$&!p)./ ' &)br'r,, +$&p!
how can composer spread my library around?
{
"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": "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!
{
"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
{
"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!
{
"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.
{
"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
Q2)*5! I w'..' p'(*+ (+)0!
B!!(0(r'pp)./ L)br'r, C!.(r)b2()!.
$ 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()!.
$ 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()!.
is now default
T'/ ,!2r r$&$'0$0!
use semver and always make tags for releases
T'/ ,!2r r$&$'0$0!
use semver and always make tags for releases
X.Y.Z
Up/r'-)./ (! ' M'$0(r!
B2( I .$$- ' 0p$*)6* v$r0)!.
version modifiers to the rescue!
"acme/foo": "1.0.x-dev#3ebbe75"
"acme/foo": "1.0.x-dev#3ebbe75"
“#<ref>”: Get this specific commit
"acme/foo": "1.0.x-dev#3ebbe75"
"acme/foo": "@dev"
"acme/foo": "1.0.*@beta"
“#<ref>”: Get this specific commit
"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
I .$$- (! 8$*2($ ' f$w 0*r)p(0
how to automate tasks with Composer
    "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": {
        "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
C20(!" R$p#)(!r)$0 !r .!
C!"p#$r, w+'( .!w?
Injecting Composer into wild packages
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
“hero/superpackage”: “dev-master”
    "repositories": [
{
"type": "vcs",
"url": "https://github.com/rdohms/hero-superpackage"
}       
]
“hero/superpackage”: “dev-master”
    "repositories": [
{
"type": "vcs",
"url": "https://github.com/rdohms/hero-superpackage"
}       
]
my fork
“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
{
"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'/$
{
"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'/$
{
"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'/$
I .$$- (+)0 PEAR p'*5'/$...
No Problem!
{
"repositories": [
{
"type": "pear",
"url": "http://pear2.php.net"
}
],
"require": {
"pear-pear2.php.net/PEAR2_Text_Markdown": "*",
"pear-pear2/PEAR2_HTTP_Request": "*"
}
}
{
"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
{
"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!
{
"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!!
1.-)./ ,!2r (2.$
I .$$- ' &)br'r, (+'( -!$0..
Let me get that for you
http://packagist.org/
versions
package info
usage info
$ composer.phar search filter
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
$ composer.phar show dms/dms-filter-bundle
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
B2( ", r$p#)(!r, )0 pr)v'($!
Get your own package repository
S'()0!
$ composer.phar create-project composer/satis
R!&&!2( ,!2r !w. S'()0
$ 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!&&!2( ,!2r !w. S'()0
$ 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!&&!2( ,!2r !w. S'()0
{
"repositories": [
{
"type": "composer",
"url": "http://packages.yourdomain.net"
}
],
“require”: {
“myvendor/mypackage”: “dev-master”
}
}
U0)./ ,!2r !w. S'()0
{
"repositories": [
{
"type": "composer",
"url": "http://packages.yourdomain.net"
}
],
“require”: {
“myvendor/mypackage”: “dev-master”
}
}
U0)./ ,!2r !w. S'()0
“composer”: use this just like it was
Packagist
W+$r$ 0+!2&- I /$( +$&p?
http://getcomposer.org
#composer on irc.freenode.org
%$ 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
%'.5 Y!2!
http://slides.doh.ms
http://doh.ms
@rdohms
https://joind.in/8464

More Related Content

What's hot

Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
Joshua Thijssen
 
Baremetal deployment scale
Baremetal deployment scaleBaremetal deployment scale
Baremetal deployment scale
baremetal
 
Baremetal deployment
Baremetal deploymentBaremetal deployment
Baremetal deployment
baremetal
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
ronnywang_tw
 

What's hot (20)

Composer
ComposerComposer
Composer
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
aptly: Debian repository management tool
aptly: Debian repository management toolaptly: Debian repository management tool
aptly: Debian repository management tool
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 
Asynchronous Systems with Fn Flow
Asynchronous Systems with Fn FlowAsynchronous Systems with Fn Flow
Asynchronous Systems with Fn Flow
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
 
Baremetal deployment scale
Baremetal deployment scaleBaremetal deployment scale
Baremetal deployment scale
 
Baremetal deployment
Baremetal deploymentBaremetal deployment
Baremetal deployment
 
Conan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for DevelopersConan.io - The C/C++ package manager for Developers
Conan.io - The C/C++ package manager for Developers
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?Git, CMake, Conan - How to ship and reuse our C++ projects?
Git, CMake, Conan - How to ship and reuse our C++ projects?
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
 
Conan a C/C++ Package Manager
Conan a C/C++ Package ManagerConan a C/C++ Package Manager
Conan a C/C++ Package Manager
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
 
Laravel 4 package development
Laravel 4 package developmentLaravel 4 package development
Laravel 4 package development
 
今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
OSDC 2014: Ole Michaelis & Sönke Rümpler: Make it SOLID - Software Architectu...
 

Viewers also liked

Viewers also liked (6)

Weekly newsletter
Weekly newsletterWeekly newsletter
Weekly newsletter
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16
 
Writing Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
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. - #PHPSRB16“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. - #PHPSRB16
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
 

Similar to Composer for busy developers - DPC13

Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 

Similar to Composer for busy developers - DPC13 (20)

PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 

More from Rafael Dohms

More from Rafael Dohms (20)

The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024
 
Application Metrics - IPC2023
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023
 
How'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision RecordsHow'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision Records
 
Architectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBR
 
Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
 
Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
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. - PHPKonf“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. - PHPKonf
 
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
 
“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.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
 
A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015A Journey into your Lizard Brain - PHP Conference Brasil 2015
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.
“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.“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.
“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
Journey into your Lizard Brain - PHPJHB15Journey into your Lizard Brain - PHPJHB15
Journey into your Lizard Brain - PHPJHB15
 
Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15Composer The Right Way #PHPjhb15
Composer The Right Way #PHPjhb15
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 

Composer for busy developers - DPC13