Updated: 02 May 2023
require command adds new packages to the composer.json file. A composer.json file will be created if one doesn’t exist. After adding/changing the requirements, the modified requirements will be installed or updated.
--update-with-dependencies (-w): Also update dependencies of the newly required packages, except those that are root requirements.
--update-with-all-dependencies (-W): Also update dependencies of the newly required packages, including those that are root requirements.
Update a single package
composer update doctrine/doctrine-fixtures-bundle
php composer.phar remove vendor/package vendor/package2
List all packages and their versions
Install package at a particular version
composer require drupal/commerce_pricelist:2.0-rc2
install command reads the
composer.json file from the current directory, resolves the dependencies, and installs them into
Deletes all content from Composer’s cache directories.