@@ -62,7 +62,7 @@ The ``load()`` method never overwrites existing environment variables. Use the
62
62
// ...
63
63
$dotenv->overload(__DIR__.'/.env');
64
64
65
- As you're working with the `` Dotenv `` component you'll notice that you might want
65
+ As you're working with the Dotenv component you'll notice that you might want
66
66
to have different files depending on the environment you're working in. Typically
67
67
this happens for local development or Continuous Integration where you might
68
68
want to have different files for your ``test `` and ``dev `` environments.
@@ -74,18 +74,19 @@ You can use ``Dotenv::loadEnv()`` to ease this process::
74
74
$dotenv = new Dotenv();
75
75
$dotenv->loadEnv(__DIR__.'/.env');
76
76
77
- The ``Dotenv `` component will then look for the correct ``.env `` file to load
78
- in the following order::
77
+ The Dotenv component will then look for the correct ``.env `` file to load
78
+ in the following order whereas the files loaded later override the variables
79
+ defined in previously loaded files::
79
80
80
- 1 . If ``.env `` exists, it is loaded first. In case there's no ``.env `` file but a
81
+ # . If ``.env `` exists, it is loaded first. In case there's no ``.env `` file but a
81
82
``.env.dist ``, this one will be loaded instead.
82
- 2 . If one of the previously mentioned files contains the ``APP_ENV `` variable, the
83
+ # . If one of the previously mentioned files contains the ``APP_ENV `` variable, the
83
84
variable is populated and used to load environment-specific files hereafter. If
84
85
``APP_ENV `` is not defined in either of the previously mentioned files, ``dev `` is
85
86
assumed for ``APP_ENV `` and populated by default.
86
- 3 . If there's a ``.env.$env.local `` file, this one is loaded. Otherwise, it falls
87
+ # . If there's a ``.env.$env.local `` file, this one is loaded. Otherwise, it falls
87
88
back to ``.env.$env ``.
88
- 4 . If there's a ``.env.local `` it's loaded last.
89
+ # . If there's a ``.env.local `` it's loaded last.
89
90
90
91
This might look complicated at first glance but it gives you the opportunity to commit
91
92
multiple environment-specific files that can then be adjusted to your local environment
@@ -100,7 +101,7 @@ configuration settings for your environments, each of them can be adjusted by us
100
101
101
102
You can adjust the variable defining the environment, default environment and test
102
103
environments by passing them as additional arguments to ``Dotenv::loadEnv() ``
103
- (see :method: `Symfony\C omponent\D otenv::loadEnv ` for details).
104
+ (see :method: `Symfony\\ Component\ \ Dotenv::loadEnv ` for details).
104
105
105
106
.. versionadded :: 4.2
106
107
The ``Dotenv::loadEnv() `` method was introduced in Symfony 4.2.
0 commit comments