How to Create a Plugin for Sylius?
A Sylius plugin is simply a standard Symfony bundle that extends the core Sylius behavior. The recommended way to start developing your own plugin is by using the official plugin skeleton:
It provides built-in infrastructure for development, testing, and behavior-driven development (BDD) using tools like PHPUnit and Behat.
Plugin Naming Conventions
Sylius plugins follow specific naming conventions depending on whether they are official Sylius plugins or community plugins.
Official Sylius Plugins
For plugins maintained by the Sylius team:
Namespace
Sylius\{Feature}Plugin
Sylius\InvoicingPlugin
Package
sylius/{feature}-plugin
sylius/invoicing-plugin
Community Plugins
For plugins developed by the community:
Namespace
{Vendor}\Sylius{Feature}Plugin
Acme\SyliusWishlistPlugin
Package
{vendor}/sylius-{feature}-plugin
acme/sylius-wishlist-plugin
Including Sylius in the plugin name ensures the configuration key has a sylius_ prefix (e.g., acme_sylius_wishlist), which reduces potential conflicts with other bundles.
Quickstart Guide
Create a plugin project
The directory name must end with Plugin suffix (e.g., WishlistPlugin, ShopUserCleanupPlugin).
After installation, an interactive rename script will automatically run to configure your plugin's namespace and package name according to the naming conventions.
Test the plugin via the built-in Test Application
The Plugin Skeleton includes a ready-to-use TestApplication provided by the sylius/test-application package. This is a minimal Sylius application used for testing and previewing your plugin in isolation.
You can read more about the test application here:
You can initialize it with:
This command:
Creates the database and runs migrations
Builds frontend assets
Loads fixtures
Once initialized, you can run the application with Symfony CLI:
Then open https://127.0.0.1:8000 in your browser.
This setup allows you to quickly verify your plugin behavior in a working Sylius instance without integrating it into another project.
Declare Sylius compatibility
Your plugin should explicitly define which versions of Sylius it supports. Add a clear version constraint in composer.json:
to avoid installation in incompatible environments. Make sure to test your plugin's behaviour across the intended Sylius versions using the built-in Test Application.
Implement your plugin functionality
With your plugin cleaned up and renamed, you're ready to start implementing real features.
Last updated
Was this helpful?
