agentleFS
yoanbernabeuyoanbernabeu/symfony-yoandev-skills/skills/symfony-yoandev-local-dev/SKILL.md

symfony-yoandev-local-dev

Skill4 starsChanged 3 months agoMITView on GitHub

Set up and run a Symfony project locally: PostgreSQL and Mailpit in Docker, the Symfony CLI dev server which auto-injects DATABASE_URL and MAILER_DSN from the running containers, HTTPS and HTTP/2 out of the box, and an optional FrankenPHP container for checking the app in production-like conditions before shipping. Use this skill whenever someone asks how to start or run the project, set up a development environment, get the database running, find where sent emails went, fix "connection refused" or "could not find driver", configure compose.yaml or compose.override.yaml, enable HTTPS locally, onboard onto an unfamiliar Symfony project, or verify that something works with APP_ENV=prod. Also use it when a project has no README explaining how to boot it.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the project has no fixtures and no seed data, say so rather than inventing rows — an empty application that boots is a normal outcome, …

    line 84
  2. Distinctive:

    do the assets actually compile, and are they served rather than generated.

    line 135
  3. Distinctive:

    This is a verification step, not a working environment: Do not move daily development into it: you lose instant reload and step debugging, …

    line 140

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Local development

Tier: core — a project that cannot be booted cannot be tested. The production-like container is the on-demand part: run it before shipping, not daily.

Services in Docker, PHP on the host, the Symfony CLI wiring the two together.

docker compose up -d          # PostgreSQL + Mailpit
symfony server:start -d       # dev server, HTTPS, variables injected
symfony open:local            # open the app
symfony open:local:webmail    # read the emails it sent

That is the whole daily loop. What follows is why it works and what breaks it.

The part that surprises people

You do not write DATABASE_URL or MAILER_DSN anywhere. The Symfony CLI inspects the running containers, matches each exposed container port against a table of known services, and exports the variables into the PHP process it starts.

symfony var:export --debug     # exactly what is being injected, and from where

This is why compose.override.yaml publishes ports without a host port:

services:
  database:
    ports:
      - "5432"     # not "5432:5432"

Docker picks a free host port, the CLI discovers it. Two projects run side by side and nobody edits a file to dodge a collision. Pinning the host port throws that away for no benefit.

Consequences worth knowing:

  • symfony console is not php bin/console. The first gets the injected variables, the second does not. On a project set up this way, php bin/console doctrine:migrations:migrate fails to connect while symfony console … works — and the error message does not explain why.
  • The injected variables win over .env.test. symfony console doctrine:database:drop --force --env=test drops the development database, because the Docker variables are applied regardless of --env. This is documented behaviour and it has cost people real data. Use php bin/console for anything targeting the test database.

The full detection table, the service-naming labels, and how to opt a service out: references/symfony-cli.md.

Setting up a project that has neither

Copy assets/compose.yaml and assets/compose.override.yaml to the project root. They match what the Doctrine and Mailer recipes generate, which means a project that still has its recipes needs nothing from here.

Then:

docker compose up -d
symfony console doctrine:database:create
symfony console doctrine:migrations:migrate --no-interaction
symfony console doctrine:fixtures:load --no-interaction   # if the project has fixtures
symfony server:start -d

If the project has no fixtures and no seed data, say so rather than inventing rows — an empty application that boots is a normal outcome, and quietly making up data hides the fact that onboarding is incomplete.

HTTPS, and why it is not optional here

symfony server:ca:install     # once per machine

Then every project is served over HTTPS with HTTP/2, without a certificate warning.

This matters beyond comfort. AssetMapper depends on HTTP/2 multiplexing: it serves many small files instead of one bundle. Developing over plain HTTP means the one environment where you would notice a problem behaves differently from production. It also surfaces mixed-content and secure-cookie issues on the day you write the code rather than after a deploy.

Emails

Mailpit catches everything. Nothing leaves the machine.

symfony open:local:webmail

Two things to check when emails seem to vanish:

  • They may be queued, not sent. This standard routes SendEmailMessage to the async transport, so nothing reaches Mailpit until a worker consumes it. Run symfony console messenger:consume async -vv, or accept that the mail appears late. In tests, assertQueuedEmailCount() is the assertion that applies, not assertEmailCount().
  • The mailer service must expose port 1025, which is what the CLI matches on. Port 8025 is only the web interface.

Checking it the way production will run it

The dev server is forgiving in ways production is not: the profiler is loaded, OPcache is off, assets are served through PHP, errors are visible. Some bugs only exist on the other side of that line.

docker compose -f compose.yaml -f compose.prod-like.yaml up --build
open https://localhost

assets/Dockerfile.prod-like builds with APP_ENV=prod, production php.ini, an authoritative classmap and asset-map:compile. It answers questions the dev server cannot:

  • do the assets actually compile, and are they served rather than generated;
  • does the application boot without dev-only bundles;
  • is anything depending on the profiler or on APP_DEBUG=1;
  • does a page still work when errors stop being displayed.

This is a verification step, not a working environment. Do not move daily development into it: you lose instant reload and step debugging, and you pay a rebuild for every change. Run it before shipping something significant, not before every commit.

It is also not a production Dockerfile. For real deployment use dunglas/symfony-docker, which handles workers, healthchecks, non-root users and TLS. Details and the checklist of what to look at while it runs: references/frankenphp.md.

When something does not start

SymptomCause
connection refused on the databaseThe container is not running, or php bin/console was used instead of symfony console
could not find driverpdo_pgsql is missing from the host PHP — the container's extensions are irrelevant here
Variables not injectedContainers started from a different directory, or the compose project name differs. Check symfony var:export --debug
Port already in useA host port was pinned in compose.override.yaml. Remove it and let Docker choose
Emails never arriveThey are queued; consume the transport
Migrations run against the wrong databaseThe Docker variables override --env=test. Use php bin/console for the test database

symfony server:log shows the server, PHP and application logs in one stream, which is usually faster than opening var/log/dev.log.

Reference files

FileWhen to read it
references/symfony-cli.mdVariable injection, service detection, naming labels, worker processes
references/frankenphp.mdRunning the production-like check and what to look for

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.