Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions components/dotenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ Access the value with ``getenv()`` in your code::
$dbUser = getenv('DB_USER');
// you can also use ``$_ENV`` or ``$_SERVER``

.. note::
The ``load()`` method never overwrites existing environment variables. Use the
``overload()`` method if you need to overwrite them::

// ...
$dotenv->overload(__DIR__.'/.env');

Symfony Dotenv never overwrites existing environment variables.
.. versionadded:: 4.2
The ``Dotenv::overload()`` method was introduced in Symfony 4.2.

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