Back to course

Environment Variables (.env)

Symfony 0 to Hero: The Complete 2026 Guide

Managing Config with .env

Sensitive data like database credentials should never be in your code. Use the .env file.

text DATABASE_URL="postgresql://user:pass@127.0.0.1:5432/db"

In 2026, we also use .env.local for local overrides.