Dawid Lewandowski
Dawid Lewandowski

Reputation: 43

How should 3rd party composer packages be managed for Shopware Store Plugins that need to work with Shopware 6.4.x versions?

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

Answers (1)

j_elfering
j_elfering

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

Related Questions