Saint
Saint

Reputation: 473

Shopware plugin dependencies - additional PHP library

I've created a plugin that requires an additional php library that is not in Shopware requirements. Because of that, I cannot install the plugin on Shopware test environment to push it through Shopware plugin store, because of unmet requirements. The question is:

  1. Is adding requirements for additional PHP libraries allowed? I cannot find anything in the guidelines.
  2. How can I test this plugin in the test environment to push it to the store?

For more information: When i try to install plugin in test environment I am getting the below error

Failed Dependency

Required plugin/package "ext-imagick *" is missing or not installed and activated

Upvotes: 1

Views: 171

Answers (2)

Saint
Saint

Reputation: 473

If anyone has the same problem with missing PHP dependencies, just force your plug-in to the test phase, and when it gets rejected contact the tester that some additional libraries are required.

Also, you should add information about required libraries and who can install them to your plugin description/requirements so they are visible on the Shopware store page.

Upvotes: 0

j_elfering
j_elfering

Reputation: 3190

Additional PHP dependencies can be installed over the composer.json since shopware 6.5, refer to the docs here.

So the only thing you have to do on plugin side is to set executeComposerCommands to true, that way your composer dependencies will be installed automatically when your plugin is installed.

class SwagBasicExample extends Plugin
{
    public function executeComposerCommands(): bool
    {
        return true;
    }

}

However, it is not possible over that way to add php extensions to the system (like the mentioned ext-imagick, as composer can't do that). That has to happen on the hosting side, as those are platform packages.

Upvotes: 1

Related Questions