# Deploy Symfony

Symfony is detected from `composer.json` and runs as a PHP container on port `8080`. No Dockerfile needed - one is [generated](/platform/deployments/builds#dockerfiles-generated-or-your-own) unless the repo has its own.

## Configuration

Symfony already prefers real environment variables over `.env` files in production - set them as [environment variables](/platform/environment-variables), per environment:

- `APP_ENV=prod` and `APP_SECRET`.
- Anything your bundles read (`MAILER_DSN`, `MESSENGER_TRANSPORT_DSN`, ...) - the bulk editor takes a whole `.env` paste.

Containers receive variables at runtime; the image build runs [without them](/platform/deployments/builds#environment-variables-at-build-time), so `composer install` and cache warmup in the build must not depend on secrets.

## Database

Doctrine reads `DATABASE_URL` natively - set it from the database's [Credentials tab](/platform/databases/connect). Run migrations where the database is reachable:

```bash
php bin/console doctrine:migrations:migrate --no-interaction
```

## Logs

Log to stderr (Monolog's `php://stderr` handler) so entries land in [runtime logs](/platform/observability#runtime-logs).

## Related

- [Connect an app](/platform/databases/connect): DATABASE_URL, TLS, per-environment databases.
- [Laravel](/platform/frameworks/laravel): The other PHP framework, same container shape.
- [Builds](/platform/deployments/builds): What the generated image does with your code.
