Sylius Plugin Development
Creating a new plugin
Arguments are appended at the end as ARGUMENTS: Company PluginName "description". Parse them to get Company (PascalCase), PluginName (PascalCase), and Description.
If no arguments are provided, use AskUserQuestion to collect Company, PluginName, and Description.
Derive the directory name from Company and PluginName:
{Company}{Name}Plugin(PascalCase concatenation, e.g.Guiziweb+Blog→GuiziwebBlogPlugin). The package name, namespace, and bundle class are set byrename-plugin.phpin step 5.Clone the skeleton:
git clone https://github.com/Sylius/PluginSkeleton.git {Company}{Name}Plugin cd {Company}{Name}Plugin rm -rf .git cp compose.override.dist.yml compose.override.ymlCheck ports: read
compose.override.ymlto identify exposed ports, then runlsofchecks in parallel. If a port is in use, find a free port and updatecompose.override.yml.Initialize Docker (this takes several minutes — run in background using
run_in_background: true):ENV=dev make initIf error, run the same command again. Wait for completion before proceeding.
Rename the plugin (via Docker, after
make initfinishes):docker compose exec php php bin/rename-plugin.php --company={Company} --plugin-name={Name} --description="{description}" --skip-interactionInitialize the database:
make database-init && make load-fixturesDisplay setup summary to the user:
Service URL Frontend http://localhost:{http_port} Admin http://localhost:{http_port}/admin MySQL localhost:{mysql_port} Mailhog http://localhost:{mailhog_port} Admin credentials:
sylius@example.com/sylius
Next steps
- Start adding resources to the plugin →
/sylius-plugin:add-model - Once the plugin is feature-complete, create a GitHub repo and push
- Publish on Packagist
- Add a Symfony Flex recipe so integrators auto-install plugin assets