Using artifact method to install modules via composer

In this post, we explain how to install modules via composer using artifact. In Magento2, you can figure out lot of frontend customizations examples but only limited examples available in the internet for admin customizations. Subscribe to Bnethos for all the Magento2 problems and customizations


Sometimes we have to check a certain module in a new Magento version which can be incompatible due to modules’s composer.json, eg. new php version not made compatible.

When there are version compatibility issues in module composer.json files, we are unable to install via “composer require” commands. In the below steps we explain how to create local repository using artifact and download the module compatibility.

Steps to add Artifact in composer.json:

Step 1: Manual way

In the project where you want to install modules,  manually add the below content in the  root composer. json :

add type artifact and url in composer.json

“type”: “artifact”,
“url”: “zips/”

Step 2: Add changes in the module you want to install.

 Do the changes in the module you want to install (i.e. something like updating the php version in module’s composer.json) and create a .zip of the module.

NOTE: The module’s name should be vendor_modulename and it should have all files like below screenshot.

Now compress the module to zip like below screenshot.

Step 3: Create a zips location folder under root directory

Create a zips folder on the root of project. Under the zips folder you can add module’s zip which we created in previous step. Add the above folder to /zips location on root. The name of the zip file should be “vendor_module” as per the above composer.json  
   e.g bnethos_hubspotcustomer

Step 4: Download the module using cmd.

Finally In your root folder, run the composer command to install the module
   composer require vendor/modulename.

   composer require bnethos/hubspotcustomer.

It will download the module from your local zips folder and add it to the vendor folder. Here zips folder act as a repository and composer download the module from that repository.

If you need more help regarding this post, feel free to ask in the Comments section below.

I would be happy to solve your queries.

31 thoughts on “Using artifact method to install modules via composer”

Leave a Comment