Passionate Free Software Developer
https://github.com/naderman
phpBB Development Lead
https://www.phpbb.com
Co-Founder of
https://www.forumatic.com
Professional Managed phpBB Hosting
allows you to set defaults for config options in all your projects
*nix: /home/example/.composer/config.json
OSX: /Users/example/.composer/config.json
Windows: C:\Users\example\AppData\Roaming\Composer\config.json
Create install requests for the requirements
(on update:) Force update installed dev packages to latest
Load lock file as a repository
Create install requests for all its packages
$ composer show --platform
$ composer show --installed
{ "repositories": [ { "type": "vcs", "url": "https://github.com/nelmio/NelmioSecretBundle" }, { "type": "vcs", "url": "https://github.com/nelmio/lib" } ], "require": { "nelmio/secret-bundle": "1.*", "nelmio/lib": "1.5.3" } }
satis.json
{ "repositories": [ { "type": "vcs", "url": "https://github.com/nelmio/NelmioSecretBundle" }, { "type": "vcs", "url": "https://github.com/nelmio/lib" } ] }
composer create-project composer/satis myrepo cd myrepo bin/satis build satis.json www/
composer.json
{ "repositories": [ { "type": "composer", "url": "https://satis.example.org/" } ], "require": { "nelmio/secret-bundle": "1.*", "nelmio/lib": "1.5.3" } }
satis.json
{ "repositories": [ { "type": "composer", "url": "https://packagist.org" } ], "require": { "symfony/symfony": "*" } }
satis.json
{ "repositories": [ { "type": "composer", "url": "https://susans-satis.example.com" }, { "type": "composer", "url": "https://johns-satis.example.com" } ], "config": { "require-all": true } }
All involved packages and their relationships in a single expression
Request: Install foo/x foo/x-v1 requires foo/y-v1 foo/x-v2 requires foo/y bar/z-v1 replaces foo/y-v2
(foo/x-v1 | foo/x-2) & (!foo/x-v1 | foo/y-v1) & (!foo/x-v1 | foo/y-v1 | foo/y-v2 | bar/z-v1)
TRUE means install if not yet installed.
FALSE means remove if currently installed.
Would take a very long time
Would either have to start over and potentially loop for a long time, or produce difficult to understand sub-optimal results
http://getcomposer.org/doc/faqs/why-can't-composer-load-repositories-recursively.md
*nix: /home/example/.composer/config.json
OSX: /Users/example/.composer/config.json
Windows: C:\Users\example\AppData\Roaming\Composer\config.json
{ "repositories": [ { "type": "composer", "url": "https://satis.example.org/" } ] }
satis.json
{ "repositories": [ { "type": "vcs", "url": "https://github.com/nelmio/NelmioSecretBundle" }, { "type": "vcs", "url": "https://github.com/nelmio/lib" } ] }
composer.json
{ "require": { "nelmio/secret-bundle": "1.*", "nelmio/lib": "1.5.3" } }
{ "repositories": [ { "type": "vcs", "url": "https://github.com/naderman/symfony" } ], "require": { "symfony/symfony": "dev-master" } }
Additional repositories take priority over the default ones
{ "repositories": [ { "type": "vcs", "url": "https://github.com/naderman/symfony" } ], "require": { "symfony/symfony": "dev-my-patch" } }
Your branches are available as well
Use composer show -v symfony/symfony
to check
{ "repositories": [ { "type": "vcs", "url": "https://github.com/naderman/symfony" } ], "require": { "symfony/symfony": "dev-my-patch as 2.1.0" "symfony-cmf/symfony-cmf": "1.0.*" } }
{ "name": "naderman/symfony", "replace": { "symfony/symfony": "2.*" } }
{ "require": { "naderman/symfony": "3.0.*" "symfony-cmf/symfony-cmf": "1.0.*" } }
{ "name": "new/name", "replace": { "old/name": "*" } }
Symfony master branch
{ "name": "symfony/symfony", "extra": { "branch-alias": { "dev-master": "2.2.x-dev" } } }
Your project
{ "require": { "symfony/symfony": "2.2.*" }, "minimum-stability": "dev" }
{ "require": { "symfony/symfony": "2.2.*@dev" } }
$ composer update -v (--verbose) Loading composer repositories with package information Updating dependencies - Updating symfony/symfony dev-master (487b8c => 885d47) Checking out 885d4733664b040765f2faab68f3aacef58d1216 Pulling in changes: 885d473 - Fabien Potencier: merged branch Tobion/empty-requ.... 13937de - Fabien Potencier: replaced self.version/2.1.* by ... a9a0f42 - Fabien Potencier: merged 2.1 3c32fd9 - Fabien Potencier: replaced self.version by 2.1.*... c5edce7 - Fabien Potencier: merged branch eventhor... 4d6dd46 - Fabien Potencier: merged branch eventhor...
$ composer install Installing dependencies from lock file Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies
Update individual packages
$ composer update package1 package2
Update only the lock file
$ composer update nothing
Makes Composer slow with old lock file format
<Seldaek> Update your lock files people, the end is nigh!
$ composer update nothing
$ composer dump-autoload --optimize
Scripts are annoying you during deployment?
$ composer install --no-scripts $ app/console assetic:dump --env=prod --no-debug web/ $ [...]
$ composer validate ./composer.json is valid
$ composer install --prefer-source
$ composer self-update
$ curl -s https://getcomposer.org/installer | php -- --check
$ composer update -v
$ rm -rf vendor/ $ composer update -v
$COMPOSER_HOME/config.json
config.json
--dry-run
and --verbose
to get more infocomposer update nothing
composer dump-autoload --optimize