Installing modules' Composer dependencies

Last updated on
5 December 2021

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:

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

Page status: No known problems

You can: