Using Custom Plugins and Modules

If you'd like to include a plugin with your project which isn't published on Packagist you have a couple of options.

Include The Plugin In The Project Repo #

If the plugin is only being used for a single project, it makes sense to keep it inside the project's git repo.

Simply add the plugin's files anywhere below your Craft project's location. So anywhere below the folder that contains your composer.json file.

Once your plugin is in the right place you can update your composer.json to reference it using a relative path:

  "repositories": [
      "type": "path",
      "url": "./plugins/my-custom-plugin"

Now your plugin will be included and installed within the next bundle that you create.

Use a Separate Repo For Your Plugin #

If the plugin might be used for multiple projects it makes sense to set up a private repo on GitHub or GitLab to store your plugin, and reference that from within composer.json.

You can read more about how to set that up from the official composer documentation.

If you have any trouble getting composer to authenticate with private repos, have a look over the Composer and Private Repositories troubleshooting docs.