This guide will take you through the steps to get a plugin ready for the community store. Our Quality Guidelines for Plugins in the Shopware Community Store should also be read very carefully.
Every plugin needs to have a vendor prefix. The vendor prefix should be in the root folder name and has to be in the name of the plugin base class. Here is an example:
SwagStorePlugin
├── composer.json
├── src
└── SwagStorePlugin.php
The Swag
prefix is the vendor prefix in this case(shopware AG). The plugin base class should also have the prefix and can look like this:
SwagStorePlugin/src/SwagStorePlugin.php
<?php declare(strict_types=1);
namespace Swag\StorePlugin;
use Shopware\Core\Framework\Plugin;
class SwagStorePlugin extends Plugin
{
}
The composer.json
file holds all the meta information for your plugin. Here is a minimal example:
SwagStorePlugin/composer.json
{
"name": "swag/store-plugin",
"description": "Store plugin example",
"type": "shopware-platform-plugin",
"license": "MIT",
"version": "1.0.0",
"authors": [
{
"name": "shopware AG"
}
],
"autoload": {
"psr-4": {
"Swag\\StorePlugin\\": "src/"
}
},
"require": {
"shopware/core": "~6.2.0"
},
"extra": {
"shopware-plugin-class": "Swag\\StorePlugin\\StorePlugin",
"label": {
"de-DE": "Store plugin example",
"en-GB": "Store plugin example"
},
"description": {
"de-DE": "Dies ist ein Community Store Plugin",
"en-GB": "This is a community store plugin"
}
}
}
Important:
"shopware/core": "~6.2.0"
if the plugin needs the shopware core. It is also possible to require other parts like the administration: "shopware/administration": "~6.2.0"
or storefront: "shopware/storefront": "~6.2.0"
. Do not forget to replace the version with the required version for your plugin.MIT
license which would allow your customers to use your plugin and release it again with their own name for example.For more information about the available options and more details take a look at the plugin meta information reference.
The favicon of a plugin is a requirement for a community store plugin. Therefore a 40 x 40 px png file can be shipped with the following path/filename: SwagStorePlugin/src/Resources/config/plugin.png
. More information in the plugin meta information reference.
A changelog is required for every community store plugin. This file contains the version changes of the plugin. It has to be called CHANGELOG.md
and should at least contain the initial version:
SwagStorePlugin/CHANGELOG.md
# 1.0.0
- First version of the community store plugin
More information can be found in the plugin changelog guide.
The plugin needs to be packed as a zip file with the right structure in order to work with the community store. Here is an example of the folder structure:
SwagStorePlugin
├── composer.json
├── src
└── SwagStorePlugin.php
Be aware that the folder SwagStorePlugin
should be the root folder of the zip file.
Plugins are automatically checked with PhpStan and SonarQube to ensure a certain code quality. The configurations used during the automatic code review con be found on GitHub: Code reviews for Shopware 5 and 6 on GitHub.
If the automatic code review fails for a plugin an error with the reason is provided. We have a list of common errors and their fixes in the code review section of the plugin quality guidelines
If your plugin includes Javascript files, please make sure, that you include the folder src/Resources/app/storefront/dist
in your zip file. This is necessary because your Javascript files won't be compiled, when the plugin is activated in the administration.