Making a basic “Hello World” plugin for Shopware 6.6 is explained in this tutorial. Based on the given sample plugin, it covers the fundamental architecture and implementation.
Prerequisites
Before starting, ensure that you have the following:
- Shopware 6.6 is installed on your local or server environment.
- Basic knowledge of PHP, Shopware plugin structure, and Symfony components.
- Command-line tools and access to the Shopware installation directory.
Plugin installation
The following command can be used to create a plugin:
bin/console plugin:create HelloWorld
HelloWorld is the module’s name.
After that, there will be questions. The first one will be about a required namespace, which in our case is Vendor. Next, there will be questions about generating examples for various jobs, to which you must say “no“, but you can also leave the answer blank or “yes” if you want to see how you might accomplish one of them.
This is how it appears:

The developer documentation includes a thorough installation guide for the module.
Plugin Structure
A Shopware plugin typically includes:
- Controllers: handle the business logic.
- Configuration files: manage routes, services, and settings.
- Templates: render the
frontend.
The structure for the HelloWorld plugin is as follows:
HelloWorld/
├── composer.json
└── src/
├── HelloWorld.php
├── Storefront/Controller/
│ ├── ExampleController.php
├── Resources/config/
│ ├── routes.xml
│ ├── config.xml
│ └── services.xml
└── Resources/views/storefront/page/
└── example.html.twig
Creating a Controller
For our new page, we must create a controller ExampleController.php:
<?php declare(strict_types=1);
namespace Vendor\Storefront\Controller;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route(defaults: ['_routeScope' => ['storefront']])]
class ExampleController extends StorefrontController
{
#[Route(
path: '/example',
name: 'frontend.example.example',
methods: ['GET']
)]
public function showExample(Request $request, SalesChannelContext $context): Response
{
return $this->renderStorefront('@HelloWorld/storefront/page/example.html.twig', [
'example' => 'Hello world'
]);
}
}
You can get comprehensive instructions on how to design a custom controller in Shopware 6.6 here. As we will do below, it will also demonstrate how to register them in routes.xml and service.xml.
Registering Routes
Registers the controller route in routes.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
https://symfony.com/schema/routing/routing-1.0.xsd">
<import resource="../../Storefront/Controller/**/*Controller.php" type="attribute" />
</routes>
Registers the controller route in service.xml:
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="Vendor\Storefront\Controller\ExampleController" public="true">
<call method="setContainer">
<argument type="service" id="service_container"/>
</call>
<call method="setTwig">
<argument type="service" id="twig"/>
</call>
</service>
</services>
</container>
Creating Views
To display the content on the page, we need a template.
Frontend template for the /example route:
{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_content %}
<h1>{{ example }}</h1>
{% endblock %}
You can read about how templates are created in detail in the developer’s documentation.
Plugin installation and results
Plugin installation
The plugin has to be installed and active in order to function. This can be accomplished using the following command in the admin panel:
bin/console plugin:refresh
bin/console plugin:install --activate HelloWorld
bin/console cache:clear
Results
The outcome below is obtained after all the files have been created and the plugin has been installed.
The “Hello World” page appears when we navigate to the path “/example“:

Conclusion
This plugin shows how to:
- define routes and controllers;
- render a basic frontend template;
- register services and dependencies.