File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -646,18 +646,23 @@ This example shows how you could configure the application secret using an env v
646646 ]);
647647 };
648648
649- Your env vars may also be accessed in your code thanks to PHP super
650- globals ``$_ENV `` and ``$_SERVER ``. Both are equivalent::
651-
652- $databaseUrl = $_ENV['DATABASE_URL']; // mysql://db_user:db_password@127.0.0.1:3306/db_name
653- $env = $_SERVER['APP_ENV']; // prod
654-
655649 .. versionadded :: 5.3
656650
657651 The ``env() `` configurator syntax was introduced in 5.3.
658652 In ``PHP `` configuration files, it will allow to autocomplete methods based
659653 on processors name (i.e. ``env('SOME_VAR')->default('foo') ``).
660654
655+ .. note ::
656+
657+ Your env vars can also be accessed via the PHP super globals ``$_ENV `` and
658+ ``$_SERVER `` (both are equivalent)::
659+
660+ $databaseUrl = $_ENV['DATABASE_URL']; // mysql://db_user:db_password@127.0.0.1:3306/db_name
661+ $env = $_SERVER['APP_ENV']; // prod
662+
663+ However, in Symfony applications there's no need to use this, because the
664+ configuration system provides a better way of working with env vars.
665+
661666.. seealso ::
662667
663668 The values of env vars can only be strings, but Symfony includes some
You can’t perform that action at this time.
0 commit comments