p16r.nl

Shopware 6 - Custom plugins vs custom static plugins

September 09, 2020 - 3 min read

When we first started developing our plugins in Shopware 6, we started on the shopware/development template. This template only has the custom/plugins folder and not the custom/static-plugins folder, so we placed our plugins in custom/plugins.

However, when we moved to the shopware/production template, we found the custom/static-plugin folder. I did a little research about what the differences are and here’s my conclusion.

custom/static-plugins is, as it says in the docs, for project-specific plugins.

The custom/plugins directory is for what people in the Shopware community call “Store Plugins”. This term was initially confusing for me, because aren’t all plugins “Store Plugins”, since we’re building a store here? But they refer to plugins bought in the Shopware Store as “Store Plugins”. So when you buy a plugin at the Shopware Store and download it and place it into your project manually, you should place it in the custom/plugins directory.

But there’s another way to get “Store Plugins” into your installation. There is a (for now) unofficial Composer repository with all store plugins which you can access at packages.friendsofshopware.com. When you log in here and choose your shop, the available packages are listed there. Just composer require them and they’ll be in your vendor/store.shopware.com dir - no need for custom/plugins!

As for now, the Frosh Packages repository is unofficial. Please upvote this issue (NEXT-10745) so we can have an official plugin composer repository.

Finally, there’s another possibility to extend your Shopware installation and its by using plain old Symfony bundles. The location of where you put the Symfony bundle doesn’t matter as autoloading takes care of it. The convention is to put it in a src directory in your project root. You can see examples of bundles instead of plugins in Shopware’s Downtown project. In this project, they extend Shopware’s Shopware\Core\Framework\Bundle class instead of Symfony’s Symfony\Component\HttpKernel\Bundle\Bundle class to be able to make use of Migrations. The main difference between bundles and plugins from a user point of view is that the Active state of a bundle cannot be managed by a shop owner as they can with plugins. Whether this is a pro or a con is up to you.

TL;DR

  1. custom/static-plugins - for project-specific custom-built plugins
  2. custom/plugins - for plugins bought in the Shopware Store and installed manually
  3. vendor/store.shopware.com - for plugins bought in the Shopware Store and installed through Composer
  4. src - for when you’re using Bundles instead of Plugins

Point 2 and 3 are technically not mutually exclusive, but practically most of the time they are. You either install Store Plugins manually, or through Composer.


Kyle Mathews

Written by Peter Jaap Blaakmeer @PeterJaap