How to create an extension for Sylius?¶
Sylius extension is nothing more but a regular Symfony bundle adding custom behaviour to the default Sylius application.
1. Create project using Composer.¶
$ composer create-project sylius/bundle-skeleton SyliusExtensionPath
The extension can be created anywhere, not only inside Sylius application, because it already has the test environment inside.
2. Get familiar with basic extension design.¶
The skeleton comes with simple application that greets a customer. There are feature scenarios in
exemplary bundle with a controller, a template and a routing configuration in
and the testing infrastructure in
tests/Application directory contains a sample Symfony application used to test your extension.
3. Remove boilerplate files and rename your bundle.¶
In most cases you don’t want your Sylius extension to greet customer like it is now, so feel free to remove unnecessary
controllers, assets and features. You will also want to change the extension’s namespace from
Acme\ExampleBundle to a
more meaningful one. Keep in mind that these changes also need to be done in
4. Implement your awesome features.¶
For the extensions, the suggested way of modifying Sylius is using the Customization Guide. There you will find a lot of help while trying to modify templates, state machines, controllers and many, many more.