Composer Cheatsheets

Adding Packages

  • Add a package as production dependency

composer require vendor/package

  • Add a package as development dependency only

composer require vendor/package --dev

Update Packages

  • Update all packages to their latest matching versions according to the composer.json file

composer update

  • Update a single package

composer update vendor/package

Delete Packages

  • Delete a package from the project

composer remove vendor/package

Install dependencies

  • Install all dependencies according to composer.json file. This is normally the first thing we do.

composer install

  • Investigate installation content without actually installing packages. It is very helpful for debugging purpose.

```composer install --dry-run ````