Composer: Cheatsheet
Running composer self-update --snapshot
will install the latest 2.0-dev snapshot.
Run composer self-update --1
to get back to the latest 1.x stable.
Key | Value |
---|
composer update | Updates all packages |
composer update --with-dependencies | Updates all packages and its dependencies |
composer update vendor/package | Updates a certain package from vendor |
composer update vendor/* | Updates all packages from vendor |
composer update --lock | Updates composer.lock hash without updating any packages |
Key | Value |
---|
composer install | Downloads and installs all packages, creates composer.lock file after |
composer install --dry-run | Simulates the install without installing anything (for creating lock file) |
Key | Value |
---|
composer require vendor/package | Adds package from vendor to composer.json’s require section and installs |
composer require vendor/package --dev | Adds package from vendor to composer.json’s require-dev section and installs it |
Key | Value |
---|
composer remove vendor/package | Removes vendor/package from composer.json and uninstalls it |