Getting started

Setup an admin panel

The Sylius Stack comes with a bunch of components that work great independently, but when they come together, that's when the stack's magic truly operates! Indeed, the highlight of this project is the ability to configure an admin panel UI within minutes.

Create a new project

You can set up the Sylius Stack on existing Symfony projects, but in the case you are starting from scratch, here is what you need to do.

# With Composer:
composer create-project symfony/skeleton my_project

# Or with Symfony CLI:
symfony new --docker --php 8.4 my_project

Install the package using Composer and Symfony Flex

Go to your project directory and run the following command:

composer require -W \
  doctrine/orm "^2.16" \
  doctrine/doctrine-bundle \
  pagerfanta/doctrine-orm-adapter \
  symfony/asset-mapper \
  sylius/bootstrap-admin-ui \
  sylius/ui-translations
Flex recipes

Type "a" or "p" to configure the packages via Symfony Flex.

Install missing tom-select assets

symfony console importmap:require tom-select/dist/css/tom-select.default.css

Run your web server

docker compose up -d
symfony serve -d

The admin panel is ready to use. Now, it's your turn!

Admin dashboard overview

Using AssetMapper

To prevent duplicate Ajax calls, disable the auto-initialized Stimulus app and Symfony UX stylesheets from the sylius/bootstrap-admin-ui package, so you can take control of Stimulus initialization in your own code.

Disabling Stimulus app & Symfony UX stylesheets from third party package

First, you need to disable the Stimulus App started by the sylius/bootstrap-admin-ui package.

# config/packages/sylius_bootstrap_admin_ui.yaml
# ...
sylius_twig_hooks:
    hooks:
        # ...
        # Disabling Symfony UX stylesheets
        'sylius_admin.base#stylesheets':
            symfony_ux:
                enabled: false    
           
        # Disabling Stimulus App        
        'sylius_admin.base#javascripts':
            symfony_ux:
                enabled: false

Starting Stimulus App

// assets/bootstrap.js
import { startStimulusApp } from '@symfony/stimulus-bundle';

const app = startStimulusApp();
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);
// assets/app.js
import './bootstrap.js';
// ...

Last updated