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 already ships with its own composer.json and vendor/ directory, so 8.x-1.x modifies core/composer.json, causing additional requirements to be downloaded into core/vendor.

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

Blog posts

Supporting organizations: 
Sponsorship & development
Sponsorship & development

Project Information

Downloads