Composer Cheatsheet
Composer Cheatsheet
All composer commands, depending on your install, may need to use php
composer.phar in the install folder for composer, instead of global/plain composer.
Installing dependencies
Command Description
composer Downloads and installs all the libraries and dependencies outlined in the
install composer.lock file. If the file does not exist it will look for composer.json
and do the same, creating a composer.lock file.
This command doesn’t change any file. If composer.lock is not present, it will create it.
composer.lock should always be committed to the repository. It has all the information
needed to bring the local dependencies to the last committed state. If that file is modified
on the repository, you will need to run composer install again after fetching the
changes to update your local dependencies to those on that file.
Updating packages
Command Description
Updating autoloader
1/3
Command Description
Adding packages
Command Description
Passing versions
Command Description
composer require vendor/pkg "1.3.2" Installs 1.3.2
Removing packages
Command Description
composer remove Removes vendor/package from composer.json and
vendor/package uninstalls it
2/3
Verifying
Command Description
composer outdated -- Show only packages that are outdated directly required by
direct the root package
3/3