Skip to content

Commit d5901c3

Browse files
committed
minor #19923 [Dotenv] Fix SYMFONY_DOTENV_PATH purpose (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- [Dotenv] Fix `SYMFONY_DOTENV_PATH` purpose After #19371 (comment), sorry for the misunderstanding on this feature! I guess https://symfony.com/blog/new-in-symfony-7-1-misc-improvements-part-2#custom-env-path will also need an update. cc `@nicolas`-grekas Commits ------- 41c4ce5 [Dotenv] Fix `SYMFONY_DOTENV_PATH` purpose
2 parents 437307b + 41c4ce5 commit d5901c3

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

configuration.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -954,15 +954,7 @@ path is part of the options you can set in your ``composer.json`` file:
954954
}
955955
}
956956
957-
You can also set the ``SYMFONY_DOTENV_PATH`` environment variable at system
958-
level (e.g. in your web server configuration or in your Dockerfile):
959-
960-
.. code-block:: bash
961-
962-
# .env (or .env.local)
963-
SYMFONY_DOTENV_PATH=my/custom/path/to/.env
964-
965-
Finally, you can directly invoke the ``Dotenv`` class in your
957+
As an alternate option, you can directly invoke the ``Dotenv`` class in your
966958
``bootstrap.php`` file or any other file of your application::
967959

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

970+
If you need to know the path to the ``.env`` file that Symfony is using, you can
971+
read the ``SYMFONY_DOTENV_PATH`` environment variable in your application.
972+
978973
.. versionadded:: 7.1
979974

980-
The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony 7.1.
975+
The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony
976+
7.1.
981977

982978
.. _configuration-secrets:
983979

0 commit comments

Comments
 (0)