Skip to content

ScaleCommerce-dev/scdev-template-sylius

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

scdev Sylius Template

A starter template for scdev that scaffolds a Sylius e-commerce project with a working local development environment.

What's included

  • PHP 8.4 via ScaleCommerce's prebuilt docker-php-cli image (ghcr.io/scalecommerce/docker-php-cli:8.4.20), which ships with all extensions Sylius needs (intl, pdo_mysql, gd, bcmath, opcache, exif, zip, plus apcu, redis, memcached, etc.), Composer, Node.js, npm, and pnpm already baked in — no runtime extension install
  • memory_limit=-1 configured via /etc/php/conf.d/zz-sylius.ini so Composer and sylius:install don't OOM on large operations
  • MySQL 8.0 database
  • Symfony CLI dev server (installed during setup)
  • Sylius Standard scaffolded via composer create-project sylius/sylius-standard (the official starting point recommended by the Sylius installation docs), then upgraded to the latest sylius/* patches via composer update (the sylius-standard meta-package ships a composer.lock that pins older versions; without this step a fresh install lands on an already-outdated core)
  • Database schema, fixtures, and default admin user installed via sylius:install
  • Shop/admin assets compiled via pnpm run build (Webpack Encore)
  • HTTPS via scdev's shared Traefik router, with SYMFONY_TRUSTED_PROXIES=private_ranges so Symfony generates https:// URLs behind the reverse proxy (without this, the admin login bounces and the Web Debug Toolbar hangs on "Loading…" — see Troubleshooting)
  • Mailpit integration (MAILER_DSN=smtp://mail:1025) — all outgoing mail is caught
  • Mutagen file sync (macOS) with vendor/, var/, node_modules/, public/build/, public/bundles/, public/media/, public/assets/, .scdev/, and .setup-complete kept inside the container for speed

Usage

scdev create sylius my-shop
cd my-shop
scdev setup

Setup takes several minutes (Composer pulls ~400 MB of dependencies). When it finishes, the shop is running at https://my-shop.scalecommerce.site.

Default credentials

  • Storefront: https://my-shop.scalecommerce.site/
  • Admin panel: https://my-shop.scalecommerce.site/admin/
    • Email: sylius@example.com
    • Password: sylius

What scdev setup does

  1. Starts the Docker containers (app + MySQL) — PHP, extensions, Composer, Node, npm, and pnpm all come from the ghcr.io/scalecommerce/docker-php-cli:8.4.20 image
  2. Writes memory_limit=-1 to /etc/php/conf.d/zz-sylius.ini and installs the Symfony CLI
  3. Scaffolds Sylius via composer create-project sylius/sylius-standard /tmp/app and copies it into /app
  4. Runs composer update --with-all-dependencies sylius/sylius sylius/sylius-standard — picks up the latest 2.x patch releases (see "What's included" for why this matters)
  5. Waits for MySQL to accept connections
  6. Runs php bin/console sylius:install --no-interaction — creates the database schema, loads fixtures, sets up the admin user
  7. Runs pnpm install && pnpm run build — compiles the shop and admin frontend assets via Webpack Encore (must run after composer update because package.json has file:vendor/sylius/sylius/... entries)
  8. Marks setup complete — the Symfony dev server starts automatically

Full script: .scdev/commands/setup.just.

Development

Edit files in src/, templates/, or config/ and refresh the browser — Symfony reloads on every request in dev mode.

Common commands:

scdev exec app composer require <package>                       # Add a PHP package
scdev exec app composer update sylius/* --with-all-dependencies # Upgrade Sylius to latest patches
scdev exec app php bin/console <command>                        # Run any Symfony console command
scdev exec app php bin/console doctrine:migrations:migrate      # Apply pending migrations
scdev exec app php bin/console sylius:fixtures:load default     # Reload default fixtures
scdev exec app php bin/console cache:clear                      # Clear the cache
scdev exec app pnpm run build                                   # Rebuild frontend assets
scdev exec app pnpm run watch                                   # Rebuild assets on change
scdev exec app bash                                             # Open an interactive shell
  • scdev db — opens Adminer. Connect with server db, user root, password sylius, database sylius.
  • scdev mail — opens Mailpit. All outgoing mail shows up here.
  • scdev logs -f app — follow app container logs.
  • scdev update — apply .scdev/config.yaml changes (env, image, command, volumes). scdev restart alone won't — it preserves the container.

Customizing

  • Change DB password / name in .scdev/config.yaml under variables:, then scdev down -v (removes DB volume so MySQL reinitializes with new credentials) and scdev start.
  • Change the internal HTTP port by overriding PORT in .scdev/config.yaml variables: (defaults to 80). Traefik terminates HTTPS externally, so this only affects the Symfony dev server inside the container.
  • After editing shop/admin assets under assets/, run scdev exec app pnpm run build or scdev exec app pnpm run watch to recompile.
  • Any other .scdev/config.yaml change: scdev update diffs the config against running containers and recreates only what changed.

Troubleshooting

Admin shows "There is a new version of Sylius available"

Expected, but still worth knowing about. The Sylius admin runs a live check against Packagist on every login and reports when sylius/sylius has newer patches than what's installed. Even with this template's composer update step, the sylius/* constraints are governed by the sylius/sylius-standard meta-package, which itself is tagged less frequently than core patches.

To catch up manually at any time:

scdev exec app composer update sylius/* --with-all-dependencies
scdev exec app php bin/console doctrine:migrations:migrate --no-interaction   # if the upgrade adds migrations
scdev exec app pnpm install && scdev exec app pnpm run build                    # if vendor assets changed

Stuck "Loading…" debug toolbar / admin login doesn't work / mixed-content errors in browser console

This shouldn't happen with this template — SYMFONY_TRUSTED_PROXIES=private_ranges is set in .scdev/config.yaml. If you forked the template and dropped that env var, add it back: Traefik terminates HTTPS and forwards HTTP to the Symfony server, so without it Symfony generates http:// URLs inside the HTTPS page and the browser blocks them.

Storefront 500s with "Asset manifest file … manifest.json does not exist"

Webpack Encore hasn't built. Either scdev setup was skipped (run it), or you ran scdev down -v which cleared public/build. The container's entrypoint auto-rebuilds on next start when the manifest is missing — scdev restart should be enough. If it persists, run scdev exec app pnpm install && scdev exec app pnpm run build manually.

Config change isn't taking effect

scdev restart preserves the container. For env, image, command, or volume changes in .scdev/config.yaml, run scdev update — it diffs and recreates only what changed. Code changes (via bind mount / Mutagen) don't need any restart.

ghcr.io/scalecommerce/docker-php-cli:8.4.20 image pull fails

The image is published to GitHub Container Registry and should pull without authentication. If Docker reports an auth or not-found error, make sure your Docker daemon can reach ghcr.io (check proxy/VPN settings) and that you're not rate-limited. As a fallback, swap the image in .scdev/config.yaml for a public equivalent (e.g. php:8.4-cli-alpine plus manual extension install).

Requirements

Learn more

About

scdev template for Sylius 2.x e-commerce — scaffolds Sylius Standard + MySQL + Webpack Encore + HTTPS + mailpit, ready in one command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages