diff --git a/components/dotenv.rst b/components/dotenv.rst index fae35a5b5f2..daa0a197441 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -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
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: