Installation
1. Prepare Your Environment
Before installing the plugin, ensure that your project:
Uses Symfony Flex
Runs a supported Sylius 2.x version
Has yarn and Symfony Encore correctly configured
2. Allow Symfony Contrib Recipes
To allow Symfony to install community recipes:
composer config extra.symfony.allow-contrib true
If prompted during plugin installation, accept the community recipe when asked.
3. Install the Plugin via Composer
composer require sylius/cms-plugin
This will install the plugin and apply the Flex recipe, which registers required services and configuration.
4. Install Required JavaScript Packages
The CMS plugin uses trix
for rich text editing and swiper
for image galleries.
Run the following commands:
yarn add trix@^2.0.0 swiper@^11.2.6 @sylius-cms-plugin/admin@file:vendor/sylius/cms-plugin/assets/admin
And add the following JS controller:
// controllers.json
{
"@sylius-cms-plugin/admin": {
"preview": {
"enabled": true,
"fetch": "lazy"
}
}
}
Then compile the frontend assets:
yarn encore dev # or yarn encore prod
5. Run Doctrine Migrations
The plugin comes with database changes. Run:
bin/console doctrine:migrations:migrate # add `-e prod` for production
6. Clear the Cache
Finally, clear the Symfony cache to ensure changes are applied:
bin/console cache:clear
Installation Complete!
You can now manage CMS content through the Sylius Admin Panel under the new "CMS" section.
Last updated
Was this helpful?