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?


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.