Reputation: 43
I'm wondering about the best way to manage 3rd party composer packages within a Shopware 6 extension that I intend to release on the Shopware Store. I initially tried an approach involving creating a directory for these packages and autoloading them in the composer.json file
So i placed 3rd party package under:
pluginRoot/libs/3rdPartyPackage
Then, I modified my composer.json file as follows:
"autoload": {
"psr-4": {
"Stack\\Example\\": "src/",
"3rdParty\\": "libs/3rdPartyPackage/src/"
}
},
However this approach was rejected during manual code review during plugin review process.
I'm aware that starting from version 6.5, the "executeComposerCommands" method in Shopware\Core\Framework\Plugin
is available.
Additionally, if our plugin's initial version is compatible with both 6.5 and earlier versions, should we maintain separate plugin versions with different approaches?
Upvotes: 0
Views: 90
Reputation: 3190
Before Shopware 6.5, you need to include the vendor folder of your plugin in the zip file that you upload and autoload those dependencies in the plugin yourself. Refer to the docs for version 6.4: https://developer.shopware.com/docs/v/6.4/guides/plugins/plugins/plugin-fundamentals/using-composer-dependencies
As you likely want to change how the plugin is packaged/zipped (with the vendor folder for 6.4 and without it for 6.5) IMHO it would make sense to offer a separate plugin version for those major versions (e.g. a 1.x for 6.4 and 2.x for 6.5)
Upvotes: 0