How to Install Magento 2 Modules (Extensions)

- Magento 2

How to Install Magento 2 Extensions

If you don’t know how to install extensionsthis Magento 2 component, below you can find a detailed description of this process. The most simple and at the same time reliable solution is Magento Connect 2.0, but it will be available only after the first stable release of Magento 2. Luckily, there are several other methods.

Everything about Magento 2 on Firebear

Magento 2 Components

Magento 2 Component Manager

Magento Marketplace Merchant Guide

'

How to Install Magento 2 Extension via Composer

Now, there are only two Composer Repositories aimed at the installation of Magento 2 modules:

To add them to your your composer.json use the below code:

For packages from Packagist you don’t need to add any repositories because it is the official Composer source included by default.

Once the repositories are added to your system, any Magento 2 extension can be installed with the aid of the following commandcommand

And then run

This will install new dependencies and required Magento 2 extensions.

Then run:

This command upgrades Magento 2 data base.

Installing Magento 2 extension by copying code

I describe this type of installation on the example of the M2 sample module. Please note that parts like M2demo/M2Extension refer to VendorName/ModuleName. Since every Magento 2 module requires a particular directory structure (<VendorName>/<ModuleName>) under <your Magento install dir>/app/code, don’t forget to replace M2demo/M2Extension with the particular data related to your Magento 2 extension.

Please note that you should be logged in as a user with the permission to write to your Magento web server docroot. Typically, it can be the root or web server user.

By performing the following actions, you will install your module:

1. Enter the following commands keeping their order:

2. Go to the page of your module on Github (reference module in our case).

3. Find the Download Zip button and start your download.

4. Copy the downloaded file to your Magento server’s directory: <magento install dir>/app/code/m2demo/module-m2-extension.

5. Run the following commands keeping their order:

6. Find your <your Magento install dir>/app/etc/config.php file and open it in a text editor.

7. Add the below command under ‘modules’ => array (

8. Save the changes and close the editor.

I’ll update this Magento 2 tutorial as soon as new methods will be available. If you are looking for additional information about module installation in Magento 1.x, check our post here: How to Install Magento Extensions.

'