List env variables for Symfony application
25 July 2025 (Updated 25 July 2025)
On this page
Method 1: Verbose output
php bin/console debug:dotenv
This should output something like:
Dotenv Variables & Files
========================
Scanned Files (in descending priority)
--------------------------------------
* ⨯ .env.local.php
* ⨯ .env.dev.local
* ✓ .env.dev
* ⨯ .env.local
* ✓ .env
Variables
---------
---------- ------- ---------- ------
Variable Value .env.dev .env
---------- ------- ---------- ------
FOO BAR n/a BAR
ALICE BOB BOB bob
---------- ------- ---------- ------
php bin/console debug:dotenv foo
Method 2: Concise output
bin/console debug:container --env-vars
This should output something like:
------------ ----------------- ------------------------------------ -------------
Name Default value Real value Usage count
------------ ----------------- ------------------------------------ -------------
APP_SECRET n/a "471a62e2d601a8952deb186e44186cb3" 2
BAR n/a n/a 1
BAZ n/a "value" 0
FOO "[1, "2.5", 3]" n/a 1
------------ ----------------- ------------------------------------ -------------
php bin/console debug:container --env-vars foo
php bin/console debug:container --env-var=FOO
Links
Tagged:
Symfony recipes