Composer Manager allows contributed modules to depend on PHP libraries managed via Composer.

Composer is a command line tool for installing PHP libraries and their dependencies on a per-project basis. Nowadays, all libraries are registered on Packagist and expect to be installed via Composer. See the Composer Getting started page for more information.

How does it work?

Composer expects each project (Drupal installation, in our case) to have a single composer.json file listing all required packages. Composer Manager allows each contributed module to ship with its own composer.json file, listing the module-specific requirements. It then merges the requirements of all found modules into the consolidated composer.json file. This results in a single vendor/ directory shared across all modules which prevents code duplication and version mismatches.

7.x-1.x generates the composer.json inside sites/default/files/composer, while the vendor directory gets downloaded to sites/all/vendor. These locations are configurable.
Drupal 8 ships with a root composer.json file which should be edited to include any module requirements. Composer Manager discovers each module's composer.json file and adds it to the merge-plugin include list. The module requirements are then merged into the core requirements when Composer runs.

Consult the documentation for more details, including workflows for Drupal 6, Drupal 7 and Drupal 8.

Drupal 8

The Drupal 8 version of this module is deprecated and no longer needed, due to improvements in Drupal 8.1. Use Composer directly to get the needed modules, which will also download their required libraries.

For more information, see: Using Composer in a Drupal project, Using Composer to install Drupal packages through Drupal.org

Blog posts

Supporting organizations: 

Project information

Releases