diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst
index f9191d6ede9..710ce3da6b6 100644
--- a/configuration/env_var_processors.rst
+++ b/configuration/env_var_processors.rst
@@ -279,12 +279,42 @@ Symfony provides the following env var processors:
``env(csv:FOO)``
Decodes the content of ``FOO``, which is a CSV-encoded string:
- .. code-block:: yaml
+ .. configuration-block::
- parameters:
- env(TRUSTED_HOSTS): "10.0.0.1, 10.0.0.2"
- framework:
- trusted_hosts: '%env(csv:TRUSTED_HOSTS)%'
+ .. code-block:: yaml
+
+ # config/packages/framework.yaml
+ parameters:
+ env(TRUSTED_HOSTS): "10.0.0.1, 10.0.0.2"
+ framework:
+ trusted_hosts: '%env(csv:TRUSTED_HOSTS)%'
+
+ .. code-block:: xml
+
+
+
+
+
+
+ ["10.0.0.1", "10.0.0.2"]
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->setParameter('env(TRUSTED_HOSTS)', '["10.0.0.1", "10.0.0.2"]');
+ $container->loadFromExtension('framework', [
+ 'trusted_hosts' => '%env(csv:TRUSTED_HOSTS)%',
+ ]);
``env(file:FOO)``
Returns the contents of a file whose path is the value of the ``FOO`` env var:
@@ -627,16 +657,54 @@ Symfony provides the following env var processors:
It is also possible to combine any number of processors:
-.. code-block:: yaml
+.. configuration-block::
+
+ .. code-block:: yaml
- parameters:
- env(AUTH_FILE): "%kernel.project_dir%/config/auth.json"
- google:
- # 1. gets the value of the AUTH_FILE env var
- # 2. replaces the values of any config param to get the config path
- # 3. gets the content of the file stored in that path
- # 4. JSON-decodes the content of the file and returns it
- auth: '%env(json:file:resolve:AUTH_FILE)%'
+ # config/packages/framework.yaml
+ parameters:
+ env(AUTH_FILE): "%kernel.project_dir%/config/auth.json"
+ google:
+ # 1. gets the value of the AUTH_FILE env var
+ # 2. replaces the values of any config param to get the config path
+ # 3. gets the content of the file stored in that path
+ # 4. JSON-decodes the content of the file and returns it
+ auth: '%env(json:file:resolve:AUTH_FILE)%'
+
+ .. code-block:: xml
+
+
+
+
+
+
+ %kernel.project_dir%/config/auth.json
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->setParameter('env(AUTH_FILE)', '%kernel.project_dir%/config/auth.json');
+ // 1. gets the value of the AUTH_FILE env var
+ // 2. replaces the values of any config param to get the config path
+ // 3. gets the content of the file stored in that path
+ // 4. JSON-decodes the content of the file and returns it
+ $container->loadFromExtension('google', [
+ 'auth' => '%env(json:file:resolve:AUTH_FILE)%',
+ ]);
Custom Environment Variable Processors
--------------------------------------