{"id":10999,"date":"2022-06-21T12:39:14","date_gmt":"2022-06-21T12:39:14","guid":{"rendered":"https:\/\/www.bay20.com\/?p=10999"},"modified":"2025-05-21T11:22:16","modified_gmt":"2025-05-21T05:37:16","slug":"wie-erstelle-ich-ein-plugin-mit-befehl-in-shopware-6","status":"publish","type":"post","link":"https:\/\/www.bay20.com\/de\/wie-erstelle-ich-ein-plugin-mit-befehl-in-shopware-6\/","title":{"rendered":"Wie erstellt man ein Plugin mit einem Befehl in Shopware 6?"},"content":{"rendered":"\n<p>Plugins in Shopware sind im Grunde eine Erweiterung der Symfony-Bundles. Plugins k\u00f6nnen ihre eigenen Ressourcen wie Assets, Controller, Services oder Tests bereitstellen. Um ein Plugin in Shopware 6 zu erstellen, folgen Sie den unten stehenden Anweisungen.<\/p>\n\n\n\n<p>Zuerst m\u00fcssen Sie eine SSH-Verbindung zu Ihrer Shopware-Website herstellen. Wenn Sie den unten stehenden Befehl ausf\u00fchren, werden alle in Shopware verf\u00fcgbaren Befehle angezeigt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/console<\/code><\/pre>\n\n\n\n<p>Um nun ein Plugin zu erstellen, f\u00fchren Sie den unten stehenden Befehl aus und f\u00fcgen Sie den technischen Namen Ihres Plugins hinzu. Um die Funktionalit\u00e4t Ihres Plugins so kurz wie m\u00f6glich zu beschreiben, schreiben Sie in Gro\u00dfbuchstaben. Um Probleme mit doppelten Plugin-Namen zu vermeiden, sollten Sie ein Kurzpr\u00e4fix f\u00fcr Ihr Unternehmen hinzuf\u00fcgen.<br>Shopware verwendet \u201eSwag\u201c als Pr\u00e4fix f\u00fcr diesen Fall.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/console plugin:create SwagCustomplugin<\/code><\/pre>\n\n\n\n<p>SwagCustomplugin ist der Name unseres Plugins. Das Plugin-Verzeichnis ist custom\/plugins.<\/p>\n\n\n\n<p>Im src-Verzeichnis befindet sich eine PHP-Klasse mit dem Namen des Plugins <strong>(SwagCustomplugin.php)<\/strong>. Diese neue Klasse <strong>SwagCustomplugin<\/strong> muss von der abstrakten Plugin-Klasse von Shopware erweitert werden, die Shopware\\Core\\Framework\\Plugin hei\u00dft. Der folgende Code wird in der Datei <strong>SwagCustomplugin.php <\/strong>eingef\u00fcgt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php declare(strict_types=1);\n\nnamespace SwagCustomplugin;\n\nuse Shopware\\Core\\Framework\\Plugin;\n\nclass SwagCustomplugin extends Plugin\n{\n}<\/code><\/pre>\n\n\n\n<p>Die<strong> composer.json<\/strong> Datei besteht aus grundlegenden Informationen, die Shopware \u00fcber Ihr Plugin wissen muss, wie zum Beispiel:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>technische Bezeichnung<\/li><li>Beschreibung<\/li><li>Autor<\/li><li>verwendete Lizenz<\/li><li>aktuelle Plugin-Version<\/li><li>erforderliche Abh\u00e4ngigkeiten<\/li><\/ul>\n\n\n\n<p>Der unten stehende Code wird in der composer.json Datei stehen. Der Typ muss shopware-platform-plugin sein, damit Shopware Ihr Plugin sicher erkennen kann und das erforderliche Feld muss mindestens shopware\/core enthalten, um die Kompatibilit\u00e4t zu pr\u00fcfen.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"name\": \"swag\/plugin-skeleton\",\n  \"description\": \"Skeleton plugin\",\n  \"type\": \"shopware-platform-plugin\",\n  \"license\": \"MIT\",\n  \"autoload\": {\n    \"psr-4\": {\n      \"SwagCustomplugin\\\\\": \"src\/\"\n    }\n  },\n  \"extra\": {\n    \"shopware-plugin-class\": \"SwagCustomplugin\\\\SwagCustomplugin\",\n    \"label\": {\n      \"de-DE\": \"Skeleton plugin\",\n      \"en-GB\": \"Skeleton plugin\"\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<p>Dies ist die Grundstruktur und alle notwendigen Dateien f\u00fcr Ihr Plugin.<\/p>\n\n\n\n<p><strong>Bitte kontaktieren Sie uns unter <strong><a href=\"mailto:manish@bay20.com\">manish@bay20.com<\/a><\/strong> oder rufen Sie uns unter <strong><a href=\"https:\/\/api.whatsapp.com\/send?phone=+918800519180&amp;text=Hi, I contacted you through your website.\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"https:\/\/api.whatsapp.com\/send?phone=+918800519180&amp;text=Hi, I contacted you through your website.\">+91-8800519180<\/a><\/strong> an, wenn Sie Unterst\u00fctzung im Zusammenhang mit Shopware ben\u00f6tigen. Sie k\u00f6nnen auch die <strong><a href=\"https:\/\/www.bay20.com\/de\/shopware-entwicklungsunternehmen\/\" title=\"https:\/\/www.bay20.com\/shopware-development\/\">Shopware<strong>-Entwicklungsseite<\/strong><\/a><\/strong> besuchen, um die von uns angebotenen Dienstleistungen zu pr\u00fcfen.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Plugins in Shopware are basically an extension of Symfony bundles. Plugins can give their own resources like assets, controllers, services, or tests. <\/p>\n","protected":false},"author":74,"featured_media":11006,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78,115,91],"tags":[],"class_list":["post-10999","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shopware","category-shopware-6","category-shopware-6-anleitungen"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/10999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/comments?post=10999"}],"version-history":[{"count":14,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/10999\/revisions"}],"predecessor-version":[{"id":17175,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/10999\/revisions\/17175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/media\/11006"}],"wp:attachment":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/media?parent=10999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/categories?post=10999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/tags?post=10999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}