In a Shopware system, there's a main composer.json
file. This manages the main project dependencies. In addition to this, Shopware plugins require you to add a composer.json
file. If these plugins are added to the system via the main composer.json
file, then the dependencies in a plugin's composer.json
file will end up in the root level vendor/
folder. This I understand.
However, it appears that plugins can also be installed locally outside of the vendor
folder, in either
./custom/plugins
or./custom/static-plugins
When a plugin is installed locally, how should its dependencies be managed?
Is the intent that, when installing a plugin locally you'll also add its dependencies to the main composer.json
file? Or is there a way to tell shopware
Hey, install this plugin's dependencies
Also -- how do the ./custom/plugins/*/packages
folders enter into this? It's my vague understanding that these are for private plugin dependencies, but I'm not sure what that means or how that code should be managed
Or am I misunderstanding the intent behind these local folders, and the expectation in Shopware 6 is that all plugins should be installed via your main composer.json
file and the custom/
folders are just legacy?
Or some other thing?
If your plugin lives within the custom/static-plugins
folder, you can just composer require my/plugin
from the root. So that's the way to use composer plugins within your project. Shopware is then searching for the composer plugin within the custom/static-plugins/* repository.
Take a look at the Require project plugins section within the Docs on how to deal with requiring composer plugins.
Within the custom/plugins
folder you have all your store plugins. That's also the reason why the content of the custom/plugins
folder is not committed to your git repo. Because plugins within custom/plugins
are coming from the Shopware store. However: You can still also just place your plugins within the custom/plugins
folder if you want to.
Regarding custom/plugins/*/packages
: You're right. Take a look at the adding private composer dependencies section within the docs.