<p>When you include the library as required in your composer file, Craft will automatically download the package and install it in the global <code>vendor</code> directory rather than in your plugin directory (since both are inside the <code>vendor</code> folder).</p>

<p>You don't have to include it and you don't have to take care for certain other plugins that require the same one.</p>

<p>This process is done while running <code>composer install &gt;&gt;yourplugin&lt;&lt;</code> or <code>composer update</code> so everytime you make a Craft update it will search for new required libraries in your plugin but it won't do it during the installation of your plugin since every library should already exist - unless you add the dependency after your composer action -> <code>composer update</code> will solve it</p>

CC BY-SA 4.0
2018-07-20T08:33:52.787Z
2018-07-20T08:33:52.787Z
Robin Schambach
<p>I'm building a plugin in which I would like to use a vendor library, but just adding it to the plugin's composer.json file doesn't seem to be enough to get it installed.</p>

<p>It works when I run composer update in the plugin's root dir but I was hoping there would be a way to have it automatically installed when the plugin is installed?</p>

<plugin-development><craft3><composer>
Require vendors in custom plugin
# Require vendors in custom plugin

(Asked by: username_0 on 2018-07-20)

I'm building a plugin in which I would like to use a vendor library, but just adding it to the plugin's composer.json file doesn't seem to be enough to get it installed.

It works when I run composer update in the plugin's root dir but I was hoping there would be a way to have it automatically installed when the plugin is installed?

**Tags:** plugin-development, craft3, composer

---

## 1 answers

### Answer by username_1 on 2018-07-20. Score: 1 | Accepted answer

When you include the library as required in your composer file, Craft will automatically download the package and install it in the global `vendor` directory rather than in your plugin directory (since both are inside the `vendor` folder).

You don't have to include it and you don't have to take care for certain other plugins that require the same one.

This process is done while running `composer install >>yourplugin<<` or `composer update` so everytime you make a Craft update it will search for new required libraries in your plugin but it won't do it during the installation of your plugin since every library should already exist - unless you add the dependency after your composer action -> `composer update` will solve it


---

