Skip to content

Commit 47551a7

Browse files
committed
feature #11313 Add documentation for the require env processor (mpdude)
This PR was squashed before being merged into the master branch (closes #11313). Discussion ---------- Add documentation for the `require` env processor Documentation for symfony/symfony#30897, discussed on the FOSSHackathon. Commits ------- 1011b42 Add documentation for the `require` env processor
2 parents 38e9f40 + 1011b42 commit 47551a7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

configuration/environment_variables.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,51 @@ Symfony provides the following env var processors:
453453
'auth' => '%env(file:AUTH_FILE)%',
454454
]);
455455
456+
``env(require:FOO)``
457+
``require()`` the PHP file whose path is the value of the ``FOO``
458+
env var and return the value returned from it.
459+
460+
.. configuration-block::
461+
462+
.. code-block:: yaml
463+
464+
# config/packages/framework.yaml
465+
parameters:
466+
env(PHP_FILE): '../config/.runtime-evaluated.php'
467+
app:
468+
auth: '%env(require:PHP_FILE)%'
469+
470+
.. code-block:: xml
471+
472+
<!-- config/packages/framework.xml -->
473+
<?xml version="1.0" encoding="UTF-8" ?>
474+
<container xmlns="http://symfony.com/schema/dic/services"
475+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
476+
xmlns:framework="http://symfony.com/schema/dic/symfony"
477+
xsi:schemaLocation="http://symfony.com/schema/dic/services
478+
https://symfony.com/schema/dic/services/services-1.0.xsd
479+
http://symfony.com/schema/dic/symfony
480+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
481+
482+
<parameters>
483+
<parameter key="env(PHP_FILE)">../config/.runtime-evaluated.php</parameter>
484+
</parameters>
485+
486+
<app auth="%env(require:PHP_FILE)%"/>
487+
</container>
488+
489+
.. code-block:: php
490+
491+
// config/packages/framework.php
492+
$container->setParameter('env(PHP_FILE)', '../config/.runtime-evaluated.php');
493+
$container->loadFromExtension('app', [
494+
'auth' => '%env(require:AUTH_FILE)%',
495+
]);
496+
497+
.. versionadded:: 4.3
498+
499+
The ``require`` processor was introduced in Symfony 4.3.
500+
456501
``env(trim:FOO)``
457502
Trims the content of ``FOO`` env var, removing whitespaces from the beginning
458503
and end of the string. This is especially useful in combination with the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy