In this guide you can find out how to install Magento 2 extensions via Composer.
To work with the Amasty Composer you need to create a Customer Account on Amasty.com (to get Access Keys).
Step 1. Log in to your server via a Command line:
Step 2. Set the directory where you would like to install the extension. Usually, for such purposes, the Magento root folder is selected.
Step 3. Connect to the Amasty Composer Repository:
composer config repositories.amasty composer <path>
In the <path> indicate:
https://composer.amasty.com/community/
- for community extensions.
https://composer.amasty.com/enterprise/
- for enterprise extensions.
Step 4. To get authorized use Access Keys generated in your Customer Account :
Amasty.com → Account → My Access Keys
You will be asked for login and password when you try to install the package from Amasty composer repository for the first time. Use the Public Key as a login and the Private Key – as a password.
Find the Magento docroot directory or a directory that you have configured as a virtual host docroot and indicate:
composer config --auth http-basic.composer.amasty.com $COMPOSER_AMASTY_USERNAME $COMPOSER_AMASTY_PASSWORD
where $COMPOSER_AMASTY_USERNAME is your Public Key and $COMPOSER_AMASTY_PASSWORD is your Private Key.
Step 5. After the authorization is successfully finished, you can start installing/updating your modules.
First, take a look at the module names in your Customer Account to make sure you call the necessary module via the Composer correctly.
Please go to Amasty.com → Account → My Downloads for paid extensions and open the My free products tab for free modules.
You will find module names for the Composer in the 'My Composer Packages' section.
Step 6. To install the module, please execute the following command:
composer require amasty/color-swatches-pro
Instead of the 'color-swatches-pro' please specify the module you need.
Step 7. To upgrade the module please execute the command:
php bin/magento setup:upgrade
The extension update process is the same as the module installation process. To update the extension, simply execute the command:
composer update <composer_name>
Instead of the 'composer_name' please specify the corresponding module name which is indicated in your customer account.
To update the version from 1.x.x to 2.x.x you need to execute the following command:
composer require <composer_name> ^x.0.0 --update-with-dependencies
Where x corresponds to the first version number. For example, to update the Improved Layered Navigation Extension for M2 from the 1.x.x version to the 2.x.x version you need to execute the command:
composer require amasty/shopby ^2.0.0 --update-with-dependencies
To update all modules execute the command:
composer update
To delete the extension via Composer, please execute the command:
composer remove <composer_name>
Instead of the 'composer_name' please specify the corresponding module name which is indicated in your customer account.
There are seven Amasty repositories (for both Community and Enterprise editions):
https://composer.amasty.com/community/ https://composer1.amasty.com/community/ https://composer2.amasty.com/community/ https://composer3.amasty.com/community/ https://composer4.amasty.com/community/ https://composer5.amasty.com/community/ https://composer6.amasty.com/community/
They are completely identical, therefore you can add several of them using different Amasty.com customer accounts.
For example:
composer config repositories.amasty_account1 composer https://composer1.amasty.com/community/ composer config repositories.amasty_account2 composer https://composer2.amasty.com/community/
The way you name them, will not affect their behavior.
This way you will have two repositories added with different customer credentials. Using several Amasty repositories does not affect the way composer commands are executed. In other words, to install the Improved Layered Navigation extension, please use the same command as usual:
composer require amasty/shopby