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

Appearance settings

Commit 1011b42

Browse filesBrowse files
mpdudewouterj
authored andcommitted
Add documentation for the require env processor
1 parent 337a9e2 commit 1011b42
Copy full SHA for 1011b42

File tree

1 file changed

+45
-0
lines changed
Filter options

1 file changed

+45
-0
lines changed

‎configuration/environment_variables.rst

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.