Hello dear readers!
Today we are happy to announce that BSS Commerce now officially supports install Magento 2 extensions via Composer with the aim of bringing the best convenience to customers.
In this article, we will provide you with full information about Composer, demonstrate its applications with Magento 2 and guide you on how to install a Magento 2 extension via Composer.
What is Composer?
Composer is a tool for dependency management in PHP. Composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.
Advantages of Using Composer
- Quick installation
By installing Magento 2 extensions via Composer, users now don’t need to visit the website multiple times to download a TAR file or .zip archive whenever installing/updating extensions. Besides, Composer will automatically install necessary modules/libraries, users don’t need to follow lengthy instructions.
- Easy management
Users can easily check out the installed extensions and their versions via Composer with a few steps. They can also update or change the version of extensions easily.
- Synchronization with Marketplace
Previously, when customers bought BSSCommerce’s extensions on Marketplace, they would install modules via Composer. When they want to update the latest version provided by BSSCommerce, they have to remove the module via Composer and re-install via SHH. But now, with the support of BSSCommerce Composer, customers can update the new versions conveniently without removing the old package. Just run the command and the new updated package is installed promptly.
How to Install Magento 2 Extension of BSSCommerce via Composer
Before installing the Magento 2 extension, please make sure that you have already installed and set up the Composer tool. In case you have not installed it yet, see the instructions here.
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/Bss/…
This is the end of the tutorial, if you have any trouble when installing Magento 2 extensions of BSSCommerce via Composer, feel free to drop a line at email@example.com.
BSS Commerce is one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize your business effectively. Furthermore, we offer FREE Installation – FREE 1-year Support and FREE Lifetime Update for every Magento extension.
CONTACT NOW to let us know your problems. We are willing to support you every time.