Skip to main content
Version: Thelia 3

bin/install Reference

bin/install is a standalone script that sets up Thelia without requiring the Symfony kernel. It works around a chicken-and-egg problem: you need a database to boot the kernel, but you need the kernel to create the database.

How it works

The script runs in two phases:

Standalone phase (no kernel needed):

  1. Checks permissions on var/, public/, local/ directories
  2. Creates the database if it does not exist
  3. Applies the core schema (thelia.sql + insert.sql)
  4. Generates a form secret for CSRF protection
  5. Writes database credentials to .env.local
  6. Registers all modules and applies their SQL schemas

Kernel phase (boots Symfony for these steps only):

  1. Configures and installs templates
  2. Imports demo data (if --with-demo)
  3. Creates admin user (if --with-admin)

Options

Theme options

OptionDefaultDescription
--frontoffice_themeflexyFront-office template
--backoffice_themedefault-twigBack-office template. default-twig is the Twig admin; default is the legacy Smarty back-office
--pdf_themedefaultPDF template
--email_themedefaultEmail template

Each of these also reads an environment variable when the flag is absent: ACTIVE_FRONT_TEMPLATE, ACTIVE_ADMIN_TEMPLATE, ACTIVE_PDF_TEMPLATE, ACTIVE_EMAIL_TEMPLATE.

Setup options

OptionDefaultDescription
--with-demo-Import demo catalog
--skip-demo-images-With --with-demo, import the catalog without its images
--with-admin-Create admin user
--strict-themes-Remove the bundles of the templates you did not select

--skip-demo-images passes --skip-images to thelia:demo:import. The demo catalog is created without downloading or copying the product images, which makes the install noticeably faster. It has no effect without --with-demo.

--strict-themes is off by default so that several templates of the same type can sit side by side in one installation, which is what lets the Twig and Smarty back-offices coexist during the migration. With the flag on, bin/install scans templates/<type>/ and removes from config/bundles.php every bundle belonging to a template other than the selected one. Use it for a lean production install, not on a development checkout where you switch templates.

Admin options (requires --with-admin)

OptionDefaultDescription
--admin_logintheliaAdmin username
--admin_passwordtheliaAdmin password
--admin_first_nameAdminAdmin first name
--admin_last_nameTheliaAdmin last name
--admin_emailadmin@thelia.netAdmin email

Database credentials

Credentials can be given either as CLI options or as environment variables. Each setting is resolved in this order: CLI option, then environment variable, then default.

OptionVariableRequiredDefaultDescription
--database_hostDATABASE_HOSTYes-Database hostname
--database_portDATABASE_PORTNo3306Database port
--database_nameDATABASE_NAMEYes-Database name
--database_userDATABASE_USERYes-Database user
--database_passwordDATABASE_PASSWORDYes-Database password

Host and name have no default: the script exits with an error if neither the option nor the variable is set. Whichever way you pass them, bin/install writes the resolved values to .env.local.

With DDEV, the variables are injected automatically (all set to db), so no database option is needed.

Examples

Minimal (DDEV)

ddev exec php bin/install --frontoffice_theme=flexy

With demo and admin (DDEV)

ddev exec php bin/install --frontoffice_theme=flexy \
--with-demo --skip-demo-images --with-admin \
--admin_login=admin --admin_password=admin123

Standard environment, credentials as options

php bin/install --database_host=localhost --database_name=thelia \
--database_user=thelia --database_password=secret \
--frontoffice_theme=flexy --with-demo --with-admin

Standard environment, credentials as variables

DATABASE_HOST=localhost DATABASE_NAME=thelia \
DATABASE_USER=thelia DATABASE_PASSWORD=secret \
php bin/install --frontoffice_theme=flexy --with-demo --with-admin

Custom themes

ddev exec php bin/install --frontoffice_theme=myTheme --strict-themes

Dual layout support

bin/install auto-detects the project layout:

LayoutDetectionUse case
Development (thelia/thelia)core/ at project rootContributing to Thelia
Project (thelia/thelia-project)vendor/thelia/core/Building a store

You do not need to configure anything.

bin/test-prepare

A stripped-down variant for CI and test environments. It creates the database, applies the schema, and registers modules. It skips the permission checks, form secret generation, templates, admin, and demo data. It accepts no CLI options.

APP_ENV=test php bin/test-prepare

See Testing for details.