Skip to content

[Dotenv] Fix SYMFONY_DOTENV_PATH purpose #19923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
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
16 changes: 6 additions & 10 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,7 @@ path is part of the options you can set in your ``composer.json`` file:
}
}

You can also set the ``SYMFONY_DOTENV_PATH`` environment variable at system
level (e.g. in your web server configuration or in your Dockerfile):

.. code-block:: bash

# .env (or .env.local)
SYMFONY_DOTENV_PATH=my/custom/path/to/.env

Finally, you can directly invoke the ``Dotenv`` class in your
As an alternate option, you can directly invoke the ``Dotenv`` class in your
``bootstrap.php`` file or any other file of your application::

use Symfony\Component\Dotenv\Dotenv;
Expand All @@ -975,9 +967,13 @@ the local and environment-specific files (e.g. ``.*.local`` and
:ref:`how to override environment variables <configuration-multiple-env-files>`
to learn more about this.

If you need to know the path to the ``.env`` file that Symfony is using, you can
read the ``SYMFONY_DOTENV_PATH`` environment variable in your application.

.. versionadded:: 7.1

The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony 7.1.
The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony
7.1.

.. _configuration-secrets:

Expand Down
Loading