Back-Office Development
The Thelia 3 back-office (admin panel) is a Symfony bundle named default-twig. It renders Twig
templates, fetches data through Repositories, and displays lists with Twig UiComponents (a
server-rendered DataTable). Modules extend it through hooks and Symfony UX (Stimulus plus
LiveComponent/TwigComponent).
The bundle lives at templates/backOffice/default-twig/. It declares its own routes with PHP 8
#[Route] attributes, along with its own hooks, templates, forms, and assets.
The previous Smarty default back-office theme is no longer recommended and will likely be dropped
in Thelia 3.1. New development targets the default-twig bundle. The two themes can run side by
side during the transition, but build any new admin screen on the Twig bundle.
Back-office vs front-office
| Aspect | Back-office (default-twig) | Front-office (Flexy) |
|---|---|---|
| Template engine | Twig | Twig |
| Data access | Repositories plus Twig UiComponents (DataTable) | DataAccessService (API) |
| Extensibility | Hooks (safe_hook, hook_block, has_hook Twig functions) plus #[AsHook] | Hooks plus Twig overrides |
| Interactivity | Stimulus plus Symfony UX (LiveComponent / TwigComponent) | Stimulus plus Symfony UX |
Activating the Twig back-office
The default-twig bundle is the back-office reference. Activate it at install time, or switch an
existing installation over to it.
# fresh install - select the default-twig back-office theme
ddev exec php bin/install \
--frontoffice_theme=flexy --backoffice_theme=default-twig \
--pdf_theme=default --email_theme=default \
--with-demo --with-admin \
--admin_login=thelia --admin_password=thelia \
--admin_first_name=thelia --admin_last_name=thelia \
--admin_email=thelia@example.com
# already installed - switch the active back-office template
ddev exec php Thelia template:set backOffice default-twig
ddev exec php Thelia cache:warmup -e dev
# build the bundle stylesheet (bin/install runs it on a fresh install)
ddev exec php bin/console sass:build
The admin is then available at https://<your-site>.ddev.site/admin.
While editing SCSS, run ddev exec php bin/console sass:build --watch so the stylesheet rebuilds
automatically. Stimulus controllers are served as-is by AssetMapper and need no build. After
editing a Twig template, clear the cache with ddev exec php Thelia cache:clear -e dev.
Bundle structure
The back-office is a regular Symfony bundle. Templates live at the bundle root (so the Thelia
parser resolver picks them up as templates/backOffice/default-twig/<name>.html.twig), and the PHP
lives under src/:
templates/backOffice/default-twig/
├── base.html.twig # base layout
├── auth-layout.html.twig # login screen
├── home.html.twig # dashboard
├── <domain>/ # one folder per business domain (catalog, customer, order, ...)