Installing modules' Composer dependencies
Composer is the PHP package manager. It provides features similar to Drupal's own dependency management, and Drush make, but for any project, not just Drupal modules. Many modules for Drupal 8 or higher depend on generic PHP packages that need to be included in a site's codebase using Composer.
Which modules have Composer dependencies?
There are a few ways to tell if a module has Composer dependencies:
- It documents the facts on its project page or in its README or INSTALL files.
- Its root directory contains a
composer.json
file. - Once #2494073: Prevent modules which have unmet Composer dependencies from being installed is fixed, Drupal core will notify you of such modules automatically.
How to install a module's Composer dependencies?
The very short explanation is to always use Composer to include modules. Run
composer require drupal/modulename
from the webroot directory, not inside the core directory, to install the module with all its Composer dependencies. Once the module has been included with Composer the module can then be enabled in Drupal. Read the guide on Enabling Modules in Drupal for more information.
Read Using Composer to manage Drupal site dependencies for more information.
NB! As of Drupal 8.1, the Composer Manager module is deprecated and not needed.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion