Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd450dab

Browse files
committed
[#8732] Minor tweaks
1 parent79074e1 commitd450dab

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

‎configuration.rst‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ instance, the framework bundle is configured in ``config/packages/framework.yaml
7272
]);
7373
7474
The top-level key (here ``framework``) references configuration for a specific
75-
bundle (``FrameworkBundle`` in this case).
75+
bundle (:doc:`FrameworkBundle</reference/configuration/framework>` in this case).
7676

7777
..sidebar::Configuration Formats
7878

@@ -207,12 +207,30 @@ a controller - see :ref:`service-container-parameters`.
207207
.. _config-dot-env:
208208
.. _config-parameters-yml:
209209

210-
The .env File
211-
~~~~~~~~~~~~~
210+
The .env File & Environment Variables
211+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212212

213213
There is also a ``.env`` file which is loaded. Its contents become environment
214214
variables in the dev environment, making it easier to reference environment
215-
variables in your code.
215+
variables in your code. When you install packages, more environment variables are
216+
added to this file. But you can also add your own variables.
217+
218+
Environment variables can be referenced in any other configuration files by using
219+
a special syntax. For example, if you install the ``doctrine`` package, then you
220+
will have an environment variable called ``DATABASE_URL`` in your ``.env`` file.
221+
This is referenced inside ``config/packages/doctrine.yaml``:
222+
223+
..code-block::yaml
224+
225+
# config/packages/doctrine.yaml
226+
doctrine:
227+
dbal:
228+
url:'%env(DATABASE_URL)%'
229+
230+
# the resolve: prefix will resolve parameters *inside* the env variable
231+
# url: '%env(resolve:DATABASE_URL)%'
232+
233+
For more details about environment variables, see:ref:`config-env-vars`.
216234

217235
The ``.env`` file is special, because it defines the values that usually change
218236
on each server. For example, the database credentials on your local development

‎configuration/environments.rst‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,10 @@ always run the application in the dev environment, independent of the
176176
Selecting the Environment for Console Commands
177177
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178178

179-
By default, Symfony commands are executed in the ``dev`` environment and with the
180-
debug mode enabled. Use the ``--env`` and ``--no-debug`` options to modify this
181-
behavior:
179+
By default, Symfony commands are executed in whatever environment is defined by
180+
the ``APP_ENV`` environment variable (usually configured in your ``.env`` file).
181+
182+
Use the ``--env`` and ``--no-debug`` options to modify this behavior:
182183

183184
..code-block::terminal
184185
@@ -191,14 +192,6 @@ behavior:
191192
# 'test' environment and debug disabled
192193
$ php bin/console command_name --env=test --no-debug
193194
194-
In addition to the ``--env`` and ``--no-debug`` options, the behavior of Symfony
195-
commands can also be controlled with the same environment variables used by
196-
``public/index.php``.
197-
198-
These environment variables are very useful for production servers because they
199-
allow you to ensure that commands always run in the ``prod`` environment without
200-
having to add any command option.
201-
202195
..index::
203196
single: Environments; Creating a new environment
204197

‎configuration/external_parameters.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ credentials outside of your project code. Database configuration is one such
1010
example. The flexibility of the Symfony service container allows you to easily
1111
do this.
1212

13+
.. _config-env-vars:
14+
1315
Environment Variables
1416
---------------------
1517

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp