Skip to content

Commit 0f535b7

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Update configuration.rst and deployment.rst for dotenv:dump command
2 parents 0de3538 + 679be09 commit 0f535b7

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

configuration.rst

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,33 @@ In production, the ``.env`` files are also parsed and loaded on each request. So
811811
the easiest way to define env vars is by creating a ``.env.local`` file on your
812812
production server(s) with your production values.
813813

814-
To improve performance, you can optionally run the ``dump-env`` command (available
815-
in :ref:`Symfony Flex <symfony-flex>` 1.2 or later):
814+
To improve performance, you can optionally run the ``dotenv:dump`` command (available
815+
in :ref:`Symfony Flex <symfony-flex>` 1.2 or later). The command is not registered
816+
by default, so you must register first in your services:
817+
818+
.. code-block:: yaml
819+
820+
# config/services.yaml
821+
services:
822+
Symfony\Component\Dotenv\Command\DotenvDumpCommand:
823+
- '%kernel.project_dir%/.env'
824+
- '%kernel.environment%'
825+
826+
In PHP >= 8, you can remove the the two arguments when autoconfiguration is enabled
827+
(which is the default):
828+
829+
.. code-block:: yaml
830+
831+
# config/services.yaml
832+
services:
833+
Symfony\Component\Dotenv\Command\DotenvDumpCommand: ~
834+
835+
Then, run the command:
816836

817837
.. code-block:: terminal
818838
819839
# parses ALL .env files and dumps their final values to .env.local.php
820-
$ composer dump-env prod
840+
$ APP_ENV=prod APP_DEBUG=0 php bin/console dotenv:dump
821841
822842
After running this command, Symfony will load the ``.env.local.php`` file to
823843
get the environment variables and will not spend time parsing the ``.env`` files.

deployment.rst

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,8 @@ most natural in your hosting environment.
163163
164164
$ composer dump-env prod --empty
165165
166-
If ``composer`` is not installed on your server, you can generate this optimized
167-
file with a command provided by Symfony itself, which you must register in
168-
your application before using it:
169-
170-
.. code-block:: yaml
171-
172-
# config/services.yaml
173-
services:
174-
Symfony\Component\Dotenv\Command\DotenvDumpCommand: ~
175-
176-
.. code-block:: terminal
177-
178-
$ APP_ENV=prod APP_DEBUG=0 php bin/console dotenv:dump
166+
If you don't have Composer installed on the production server, use instead
167+
:ref:`the dotenv:dump Symfony command <configuration-env-var-in-prod>`.
179168

180169
C) Install/Update your Vendors
181170
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)