General CLI installation
Code that extends or customizes Magento behavior is called an extension. You can optionally package and distribute extensions on the Magento Marketplace or another Magento extension distribution system.
- Modules (extend Magento capabilities)
- Themes (change the look and feel of your storefront and Admin)
- Language packages (localize the storefront and Admin)
This topic explains how to use the command line to install extensions you purchase from the Magento Marketplace. You can use the same procedure to install any extension; all you need is the extension’s Composer
name and version. To find it, open the extension’s
composer.json file and note the values for
Prior to installation, you may want to:
- Back up your database.
Enable maintenance mode:
To install an extension, you must:
- Get an extension from the Magento Marketplace or another extension developer.
- Get the extension’s Composer name and version.
- Update the
composer.jsonfile in your Magento project with the name and version of the extension.
- Verify that the extension installed properly.
- Enable and configure the extension.
Get the extension’s Composer name and version
If you already know the extension’s Composer name and version, skip this step and continue with Update your
To get the extension’s Composer name and version from the Magento Marketplace:
Log in to Magento Marketplace with the username and password you used to purchase the extension.
In the upper-right corner, click Your name > My Profile.
Click My Purchases.
Find the extension you want to install and click Technical Details.
Alternatively, you can find the Composer name and version of any extension (whether you purchased it on Magento Marketplace or somewhere else) in the extension’s
Add the extension’s name and version to your
Navigate to your Magento project directory and update your
composer require <component-name>:<version>
composer require j2t/module-payplug:2.0.2
Enter your authentication keys. Your public key is your username; your private key is your password.
Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors:
Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing j2t/module-payplug (2.0.2): Downloading (100%) Writing lock file Generating autoload files
Verify the extension
To verify that the extension installed properly, run the following command:
By default, the extension is probably disabled:
List of disabled modules: J2t_Payplug
The extension name is in the format
<VendorName>_<ComponentName>; it’s not the same format as the Composer name. Use this format to enable the extension.
Enable the extension
Some extensions won’t work properly unless you clear Magento-generated static view files first. Use the
--clear-static-content option to clear static view files when you’re enabling an extension.
Enable the extension and clear static view files:
bin/magento module:enable J2t_Payplug --clear-static-content
You should see the following output:
The following modules have been enabled: - J2t_Payplug To make sure that the enabled modules are properly registered, run 'setup:upgrade'. Cache cleared successfully. Generated classes cleared successfully. Please run the 'setup:di:compile' command to generate classes. Generated static view files cleared successfully.
Register the extension:
Recompile your Magento project: In Production mode, you may receive a message to “Please rerun Magento compile command”. Magento does not prompt you to run the compile command in Developer mode.
Verify that the extension is enabled:
You should see output verifying that the extension is no longer disabled:
List of enabled modules: J2t_Payplug List of disabled modules: None
Clean the cache:
Configure the extension in Admin as needed.
If you encounter errors when loading the storefront in a browser, use the following command to clear the cache:
Upgrade an extension
To update or upgrade an extension:
Download the updated extension file from Marketplace or another extension developer. Take note of the module-name and version.
Export the contents to your Magento root.
If a composer package exists for the extension, run one of the following.
Update per module name:
composer update vendor/module-name
Updater per version:
composer require vendor/module-name ^x.x.x
- Run the following commands to upgrade, deploy, and clean the cache.
php bin/magento setup:upgrade --keep-generated php bin/magento setup:static-content:deploy php bin/magento cache:clean