Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 302206a

Browse files
committed
minor #9568 Document the DotEnv::overload() method (fmata, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Document the DotEnv::overload() method I'm not sure how to update the doc according my PR symfony/symfony#26859 which is pending review but feel free to comment if I did a mistake. Thank you. Commits ------- 38e4f08 Reword f8a3c0d Update dotenv.rst 6325759 Update dotenv.rst c8ad296 Update dotenv.rst
2 parents 2a21457 + 38e4f08 commit 302206a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/dotenv.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ Access the value with ``getenv()`` in your code::
5858
$dbUser = getenv('DB_USER');
5959
// you can also use ``$_ENV`` or ``$_SERVER``
6060

61-
.. note::
61+
The ``load()`` method never overwrites existing environment variables. Use the
62+
``overload()`` method if you need to overwrite them::
63+
64+
// ...
65+
$dotenv->overload(__DIR__.'/.env');
6266

63-
Symfony Dotenv never overwrites existing environment variables.
67+
.. versionadded:: 4.2
68+
The ``Dotenv::overload()`` method was introduced in Symfony 4.2.
6469

6570
You should never store a ``.env`` file in your code repository as it might
6671
contain sensitive information; create a ``.env.dist`` file with sensible

0 commit comments

Comments
 (0)