Skip to content

[Dotenv] Add SYMFONY_DOTENV_PATH #19371

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
Jan 3, 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
22 changes: 22 additions & 0 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,28 @@ get the environment variables and will not spend time parsing the ``.env`` files
Update your deployment tools/workflow to run the ``dotenv:dump`` command after
each deploy to improve the application performance.

Store Environment Variables In Another File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, the environment variables are stored in the ``.env`` file located
at the root of your project. However, you can store them in another file by
setting the ``SYMFONY_DOTENV_PATH`` environment variable to the path and
filename of the file where the environment variables are stored. Symfony will
then look for the environment variables in that file, but also in the local
and environment-specific files (e.g. ``.*.local`` and
``.*.<environment>.local``). You can find more information about this
in the :ref:`dedicated section <configuration-multiple-env-files>`.

Because this environment variable is used to find the files where you
application environment variable are store, it must be defined at the
system level (e.g. in your web server configuration) and not in the
``.env`` files.

.. versionadded:: 7.1

The support for the ``SYMFONY_DOTENV_PATH`` environment variable was
introduced in Symfony 7.1.

.. _configuration-secrets:

Encrypting Environment Variables (Secrets)
Expand Down