On this page
Recommended Method for Installing, Updating, and Managing Contributed Module Libraries Using Composer
This documentation needs review. See "Help improve this page" in the sidebar.
The best-recommended method for handling libraries required by the Contrib modules is through Composer. The Contrib modules includes a composer.libraries.json file that lists all the required libraries. To install and manage these libraries, you will merge the Contrib composer.libraries.json with your site's composer.json file.
Step-by-Step Instructions:
-
Install Composer Merge Plugin: To merge the
composer.libraries.jsonfile into your maincomposer.json, install the Composer Merge Plugin. From the project directory, open a terminal and run:composer require wikimedia/composer-merge-plugin -
Modify
composer.json: Edit thecomposer.jsonfile of your Drupal website, and under the"extra": {section, add:"merge-plugin": { "include": [ "web/modules/contrib/*/composer.libraries.json" ] }Note: The
webfolder represents the directory where Drupal is installed (e.g.,docroot).From now on, whenever the
composer.jsonfile is updated, it will also read thecomposer.libraries.jsonlocated atweb/modules/contrib/*/and update accordingly.
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