Composer

Updated: 02 May 2023

The 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.

Options:

  • --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

Remove package(s)

php composer.phar remove vendor/package vendor/package2

List all packages and their versions

composer show

Install package at a particular version

composer require drupal/commerce_pricelist:2.0-rc2

The install command reads the composer.json file from the current directory, resolves the dependencies, and installs them into vendor.

composer install

Deletes all content from Composer’s cache directories.

composer clear-cache

Leave a comment