Besides installing Magento 2 extensions via SSH manually, installing via composer is another very common and simple way used by a lot of Magento users.
Hence, we will provide you with a step-by-step instruction about how to do to get a Magento 2 extension installed on the website by Composer.
Step 1: Create Access Keys And Get The Package Information
Send us an email to firstname.lastname@example.org along with the order number. We will create access keys as your requirement and then provide you with information about the packages.
Step 2: Configure Composer Repository
Firstly, you need to add a new composer repository to the BSSCommerce Composer Repository.
Type the following command in the root directory of Magento:
composer config repositories.bsscommerce composer <path>
In the path indicate:
- https://composer.bsscommerce.com/community – for Community extensions.
- https://composer.bsscommerce.com/enterprise – for Enterprise extensions.
Step 3: Install Extension
Once you have the package name and version, install the Magento 2 extension by executing the following command:
composer require package_name – For the latest version
composer require package_name:version – For the older versions
For example, you want to install the BSS One Step Checkout extension, please execute the following command:
- For the latest version:
composer require bsscommerce/module-one-step-checkout
- For version 2.1.2:
composer require bsscommerce/module-one-step-checkout:2.1.2
When you run this command for the first time, CLI will ask you to enter the Username and Password. Please fill in the access key created in Step 1.
Note: The Public key corresponds to the Username, and the Private key corresponds to the Password.
Composer will inform a message to you. If you want to save the Access key, please type Y.
In case you already saved the Access key in the server, but you want to use another Access key, do the following:
Open the file ~/.composer/auth.json and delete the username/password of the corresponding repository:
Then you install the module as usual:
php bin/magento setup:upgrade
Note: In case of occurring error, it could be that the Access key you entered is wrong, your account does not have access to this package, or the version you entered does not exist.
- If you want to update the latest version of the extension, run this command:
composer update package_name
- If you want to remove the extension, run this command:
composer remove package_name
- If you want to update another version, not the latest version of the extension, run this command:
composer remove package_name
composer require package_name: version
Note: If you installed extensions via SSH (by uploading the package) before, then when updating the extension via composer, running the command setup:upgrade will fail. In this case, you have to delete the folder you uploaded in app/code/…
This is a complete installation process you can follow to have a Magento 2 module on your website.
If you need any further support, please feel free to contact us.
We'd like to help you.