@@ -30,19 +30,59 @@ important changes:
30
30
other environments. You can also create a ``.env.test `` file for test-environment
31
31
overrides.
32
32
33
- * E) If you pass the ``--env= `` flag when running ``bin/console ``, this value will
34
- override your ``APP_ENV `` environment variable (if set). And so, if you pass
35
- ``--env=prod ``, the DotEnv component *will * try to load your ``.env* `` files.
33
+ * E) `One further change to the recipe in December 2019 `_ means that your ``.env ``
34
+ files are *always * loaded, even if you set an ``APP_ENV=prod `` environment
35
+ variable. The purpose is for the ``.env `` files to define default values that
36
+ you can override if you want to with real environment values.
36
37
37
38
There are a few other improvements, but these are the most important. To take advantage
38
39
of these, you *will * need to modify a few files in your existing app.
39
40
40
41
Updating My Application
41
42
-----------------------
42
43
43
- If you created your application after November 15th 2018, you don't need to make
44
- any changes! Otherwise, here is the list of changes you'll need to make - these
45
- changes can be made to any Symfony 3.4 or higher app:
44
+ First, make sure you're using ``symfony/flex `` version 1.2 or later:
45
+
46
+ .. code-block :: terminal
47
+
48
+ composer update symfony/flex
49
+
50
+ The easiest way to update your application is to update all of your recipes using
51
+ the :ref: `sync-recipes <updating-recipes >` command. This command will update *all *
52
+ your recipes, so it will probably include other changes beyond the ones needed for
53
+ the new environment handling.
54
+
55
+ First, rename ``.env `` to ``.env.local `` and ``.env.dist `` to ``.env ``:
56
+
57
+ .. code-block :: terminal
58
+
59
+ # Unix
60
+ $ mv .env .env.local
61
+ $ git mv .env.dist .env
62
+
63
+ # Windows
64
+ $ mv .env .env.local
65
+ $ git mv .env.dist .env
66
+
67
+ Now run:
68
+
69
+ .. code-block :: terminal
70
+
71
+ $ composer sync-recipes --force
72
+
73
+ If this asks you to overwrite uncommited changes in ``.env ``, choose "no" - you
74
+ should keep the values from your ``.env `` file.
75
+
76
+ When the command finishes, review the changes - there may be extra files or changes
77
+ from other recipes that you don't want. If you made custom changes to files, you'll
78
+ need to use re-add those (hint using ``git diff `` is a great way to see the changes
79
+ made by the recipes).
80
+
81
+ Summary of the Changes
82
+ ~~~~~~~~~~~~~~~~~~~~~~
83
+
84
+ IF you want to manually update your application, here the details: these changes
85
+ can be made to any Symfony 3.4 or higher app:
46
86
47
87
#. Create a new `config/bootstrap.php `_ file in your project. This file loads Composer's
48
88
autoloader and loads all the ``.env `` files as needed (note: in an earlier recipe,
@@ -94,3 +134,4 @@ changes can be made to any Symfony 3.4 or higher app:
94
134
.. _`comment on the top of .env` : https://github.com/symfony/recipes/blob/master/symfony/flex/1.0/.env
95
135
.. _`create a new .env.test` : https://github.com/symfony/recipes/blob/master/symfony/phpunit-bridge/3.3/.env.test
96
136
.. _`phpunit.xml.dist file` : https://github.com/symfony/recipes/blob/master/symfony/phpunit-bridge/3.3/phpunit.xml.dist
137
+ .. _`One further change to the recipe in December 2019` : https://github.com/symfony/recipes/pull/501
0 commit comments