Installing Magento 2 Extensions with PHP Composer and Extension Manager

by admin February 14, 2018

Magento 2 extensions are additional modules that allow broadening the default functionality of this system. Today, we will tell you how to set third-party Magento 2 modules through Composer.

Installing Magento 2 Extensions via the Command Line

In fact, modules are not necessarily extensions. Those also include themes and language packs that can be obtained from official and third-party repositories.

In this post we will install an extension purchased in the Magento Marketplace official module store.

Editing Composer.json

First, you need the specify the title and version of the related purchase in you composer.json file. Open your Marketplace account and view the conforming purchase data under Technical Details. Notice that the same data can be obtained from the composer.json file.

Next, you should edit composer.json by indicating the following parameter:

composer require <component-name>:<version>

Before Composer starts updating dependencies, you will be asked to specify your username and password (your public and private keys respectively).

After the update process is completed, the system will display the conforming notification message.

Enabling the Extension

Now, let’s check the extension’s status (enabled or disabled) with the below parameter:

bin/magento module:status

Most likely, the status will be ‘disabled’. At this point, designate the following:

bin/magento module:enable J2t_Payplug –clear-static-content

By now, the extension should be enabled. Next, record it in the system:

bin/magento setup:upgrade

Further, re-launch the compilation process:

bin/magento setup:di:compile

Lastly, let’s check if the extension was activated:

bin/magento module:status

The module name should be output in the enabled module list.

Now, let’s explore the alternative installation option.

Installing Magento 2 Extensions from the Magento Admin Area

Synchronizing the Data

In fact, the PHP Composer’s functionality was adopted by Magento not so long ago. Thus, when making purchases from Magento Marketplace, a user can perform the installation by synchronizing the Magento 2 Extension Manager with the existing marketplace account.

When the synchronization is completed, Extension Manager will detect the purchased modules and then suggest installing them. From the Ready to Install grid, you can manage all your installations one by one or perform mass installations at once.

Installing Modules

Once you’ve chosen to set up the module, the system will suggest running the readiness check. By this way, Magento 2 verifies that your current Magento environment conforms to the correct PHP version, PHP extensions, and file permissions before installing the module.

In case some compatibility issues occur during the checking process, Magento 2 will provide recommendations on how to resolve them.

Once you’ve resolved all the issues (if any), you can commence the installation process and check the readiness again. This way, you will be guaranteed that the modules to be installed fully conform to your actual environment.

Working with Composer, Magento 2 obviates users from manual checks of modules to be installed and makes the whole installation process smooth.

So, this is how the standard module setting processes via PHP Composer look like in Magento 2. Which installation option to choose is absolutely up to you.

Conclusion

Composer allows setting up Magento 2 modules without any potential technical issues. This way, your work with Magento will be absolutely seamless.

Social Shares