Installation

This installation instruction assumes that you're using Symfony Flex and Rector. If you don't, take a look at the manual installation, but we strongly recommend using Flex and Rector for speed and simplicity.

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/product-bundle-plugin

This will install the plugin and apply the Flex recipe, registering the necessary services and configuration automatically.

4. Update and run Rector

Update <project_root>/rector.php

...
+ use Sylius\SyliusRector\Set\SyliusProductBundle;

return static function (RectorConfig $rectorConfig): void {
    // ...
    $rectorConfig->sets([
+       SyliusProductBundle::PRODUCT_BUNDLE,
    ]);
};

Run rector

vendor/bin/rector

5. Install and build assets

bin/console assets:install public

yarn install
yarn encore dev # or yarn encore prod

6. Run Doctrine Migrations

The plugin comes with database changes. Run:

bin/console doctrine:migrations:migrate # add `-e prod` for production

7. Clear the Symfony Cache

Finally, clear the Symfony cache to ensure changes are applied:

bin/console cache:clear

Last updated

Was this helpful?