Skip to content

Update configuration.rst and deployment.rst for dotenv:dump command #16416

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
Jul 13, 2023
Merged
Show file tree
Hide file tree
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
23 changes: 20 additions & 3 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,30 @@ In production, the ``.env`` files are also parsed and loaded on each request. So
the easiest way to define env vars is by deploying a ``.env.local`` file to your
production server(s) with your production values.

To improve performance, you can optionally run the ``dump-env`` command (available
in :ref:`Symfony Flex <symfony-flex>` 1.2 or later):
To improve performance, you can optionally run the ``dotenv:dump`` command (available
in :ref:`Symfony Flex <symfony-flex>` 1.2 or later). The command is not registered by default.
In order to enable it, you must add it to their services.yaml file:

.. code-block:: yaml

services:
Symfony\Component\Dotenv\Command\DotenvDumpCommand:
- '%kernel.project_dir%/.env'
- '%kernel.environment%'

On PHP >= 8, the two arguments can be removed when autoconfiguration is enabled (which is the default):

.. code-block:: yaml

services:
Symfony\Component\Dotenv\Command\DotenvDumpCommand: ~

Running command:

.. code-block:: terminal

# parses ALL .env files and dumps their final values to .env.local.php
$ composer dump-env prod
$ php bin/console dotenv:dump prod

After running this command, Symfony will load the ``.env.local.php`` file to
get the environment variables and will not spend time parsing the ``.env`` files.
Expand Down
6 changes: 3 additions & 3 deletions deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ most natural in your hosting environment.

.. code-block:: terminal

$ composer dump-env prod
$ php bin/console dotenv:dump prod

The generated file will contain all the configuration stored in ``.env``. If you
The generated file will contain all the configurations stored in ``.env``. If you
want to rely only on environment variables, generate one without any values using:

.. code-block:: terminal

$ composer dump-env prod --empty
$ php bin/console dotenv:dump prod --empty

C) Install/Update your Vendors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down