HomeMagento® 2 ExtensionsInstallation GuideInstalling a Magento® 2 Extension using Composer

Installing a Magento® 2 Extension using Composer

Add the Plugin Company Composer Repository

Edit the composer.json file in the Magento® 2 root folder, and add the following to the repositories section:

{
   "type": "composer",
   "url": "https://plugin.company/"
}

The resulting section will look something like this after doing so:

"repositories": [
    {
        "type": "composer",
        "url": "https://plugin.company/"
    },
    {
        "type": "composer",
        "url": "https://repo.magento.com/"
    }
]

Important: Make sure the plugin.company repository is listed above the default repo.magento.com repository
If the plugin.company repository isn’t listed first, composer will first check the Magento® repo for available packages and dependencies, resulting in the possible installation of outdated versions of these packages.

Install the Extension using Composer

Execute the following command to install the extension:

composer require plugincompany/extensionname

When prompted for a username and password, fill in the credentials from your Plugin Company Repository Account.

Enable the Extension

First enable the license manager using the following command:

php bin/magento module:enable PluginCompany_LicenseManager

After enabling the license manager, enable the extension using the following command:

php bin/magento module:enable PluginCompany_ExtensionName

Update the Database

Run the following upgrade command:

php bin/magento setup:upgrade

Clean the Magento® Cache

Clean the cache using the following command:

php bin/magento cache:clean

Remove auto-generated classes

Remove all auto-generated classes using the following command:

rm -Rf ./var/generation/*

Or in Magento® 2.2+

rm -Rf ./generated/*

Run the Compiler

Run the dependency injection compilation command:

php bin/magento setup:di:compile

Deploy Static View Files

Run the static content generation command:

php bin/magento setup:static-content:deploy
Was this article helpful to you? Yes No