Skip to content

Adding third party modules

We should always use composer to manage 3rd party modules, we NEVER want to add them to app code, this is a dated way to manage third party code and creates more work in future updates.

Adding Modules to GIT

If a module vendor only provides A copy of the module and no way to add it in composer then we should not add it to app/code but add it to a git repository and use composers repositories to bring in the module, keeping third party code in vendor and the source files clean.

Creating the repo

You should follow the modules setup instructions up to the setup commands but instead of placing the files in app/code/ModuleVendor/Module you should place them in a separate directory.

Run git init to turn this directory into a git repo.

Commit and add the module files then tag the release matching the version of the module.


Pushing the repo

We will now push this repo and tags to bitbucket so we can pull from multiple locations. You don't have to use bitbucket and can even setup the composer repo to use a local file path.


Adding the repo to composer

If there is no repositories section create on and add the remote to look similar to below.

    "repositories": [
            "type": "git",
            "url": ""

Now add the dependency using the tag we made earlier.

    "require": {


The name of the module can be found in the composer.json inside the module files.

Follow rest of setup

Now you can follow the rest of the setup commands in the module vendors instructions.

Updating modules

Cd in to a checked out copy of the module.


Follow the vendors instructions to apply the update up until the setup command, using the git repo of the module instead of app code.

Commit the changes and create a tag to match the updated version of the module, then push.

In the Magento 2 project you can now update the composer.json so the module is using the new tag we just made then run composer update.

Composer will update the module in vendor to use the latest changes, you can now follow the rest of the vendors update instructions.