Managing Extensions

Managing Extensions

Installation and management of extensions

Installing, managing and updating extensions in Magento 2 is handled by the composer package manager. A list of installed extensions is stored in the composer.json file in the base directory of the site along with rules specifying which version of the extension should be installed. While composer.json can be modified directly using a file editor it is recommended to have the package manager update the file automatically. For instance, the following command could be used to install an extension named Demo of version 1.0.0, and update the extension dependencies:

composer require demo:1.0.0
composer update

This will add the extension information to composer.json and update the composer.lock file, which contains more specific information about the extension to be installed, including the location of the upstream files and dependencies etc.

Once the composer.json and composer.lock files have been updated they will need to be committed and pushed to Git, and the extension will then be installed during the next build job.

Enabling/Disabling extensions

An extension installed via Composer will automatically be enabled within Magento. Should you need to disable the module temporarily the Magento CLI can be used to do so:

bin/magento module:disable <extension_name>

Likewise, re-enabling the extension can be achieved by

bin/magento module:enable <extension_name>

To verify the status of a extension, the following command can be used

bin/magento module:status <extension_name>

Once the extension has been modified, the app/etc/config.php file will need to be committed and pushed to Git to ensure the module state is persistent across builds. Modules can also be enabled/disabled manually by editing the app/etc/config.php file manually and changing the value next to the module name (0 being disabled and 1 being enabled).

Additional Resources

https://devdocs.magento.com/cloud/howtos/install-components.html