Plugin meta information

Version

6.0.0 or newer

Table of contents

To provide Shopware and the shop owner with information about your plugin, you have to supply a composer.json with your plugin. Some information are gathered through the default properties of a composer.json. For some Shopware specific information, you have to extend the extra property. Have a look at the composer schema, to learn more about the properties.

Example composer.json

{
    "name": "swag/example-plugin",
    "description": "Example plugin",
    "version": "v1.0.1",
    "type": "shopware-platform-plugin",
    "license": "MIT",
    "authors": [
        {
            "name": "Example Company",
            "homepage": "https://my.example.com",
            "role": "Manufacturer"
        }
    ],
    "require": {
        "shopware/core": "6.1.*",
        "example-plugin": "1.0.0"
    },
    "extra": {
        "shopware-plugin-class": "Swag\\ExamplePlugin\\ExamplePlugin",
        "plugin-icon": "src/Resources/config/plugin.png",
        "copyright": "(c) by shopware AG",
        "label": {
            "de-DE": "Beispiel Plugin für Shopware",
            "en-GB": "Example plugin for Shopware"
        },
        "description": {
            "de-DE": "Deutsche Beschreibung des Plugins",
            "en-GB": "English Description of Plugin"
        },
        "manufacturerLink": {
            "de-DE": "https://store.shopware.com/shopware-ag.html",
            "en-GB": "https://store.shopware.com/en/shopware-ag.html"
        },
        "supportLink": {
            "de-DE": "https://docs.shopware.com/de",
            "en-GB": "https://docs.shopware.com/en"
        }
    },
    "autoload": {
        "psr-4": {
            "Swag\\BaseClass\\": "src/"
        }
    }
}

Explanation of the properties

propertydescription
nameName of your package
descriptionThe composer JSON schema requires a short description of your package
versionCurrent version of your plugin
typeSet the type to shopware-platform-plugin. Otherwise Shopware won't be able to recognize your plugin
licenseProvide the license model of your plugin, e.g. MIT or proprietary
authorsCollection of the authors of your plugin. If one or more authors with the role Manufacturer are provided, only these will be written to the database.
requireAdd your dependencies here. This should be at least shopware/core
extraThe extra property is used to provide some Shopware specific information
extra - shopware-plugin-classThe fully qualified class name of your plugin's base class
extra - plugin-iconThe path to the plugin's icon file. This is optional if you don't have any custom plugin icon
extra - copyrightSet a copyright for your plugin
extra - labelThe name of your plugin which is displayed to the Shopware user. Translatable
extra - descriptionThe description of your plugin which is displayed to the Shopware user. Translatable
extra - manufacturerLinkLink to your homepage. Translatable
extra - supportLinkA link to your support homepage. Translatable
autoloadRequired to have a custom PSR-4 autoloader for your custom plugin directory

Requirements

The require field in the composer.json file defines on which dependencies your plugin relies. As you want to develop a plugin for Shopware, you should have at least an entry for shopware/core here. If you also rely on other parts of Shopware 6 you should als require them, e.g. shopware/storefront. In addition to that, it is also possible to define dependencies on other plugins or even every other composer package.

Translations

Some fields of the plugin entity are translatable. Shopware will try to match each of your provided translations with an existing language in the system. For more information about the translation system in Shopware have look here. Your translation locale code must look like that "de-DE", "en-GB", "de-CH", etc. If a language with this locale is not available, the translation will not be written.

Changelog

The changelog for your plugin now has to be located in another file. Have as look at our changelog guide to figure out how that's done in Shopware 6.