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

Add documentation for the require env processor #11313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add documentation for the require env processor
  • Loading branch information
mpdude authored and wouterj committed Apr 7, 2019
commit 1011b420844179cc1ae140773102a688cf358321
45 changes: 45 additions & 0 deletions 45 configuration/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,51 @@ Symfony provides the following env var processors:
'auth' => '%env(file:AUTH_FILE)%',
]);

``env(require:FOO)``
``require()`` the PHP file whose path is the value of the ``FOO``
env var and return the value returned from it.

.. configuration-block::

.. code-block:: yaml

# config/packages/framework.yaml
parameters:
env(PHP_FILE): '../config/.runtime-evaluated.php'
app:
auth: '%env(require:PHP_FILE)%'

.. code-block:: xml

<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<parameters>
<parameter key="env(PHP_FILE)">../config/.runtime-evaluated.php</parameter>
</parameters>

<app auth="%env(require:PHP_FILE)%"/>
</container>

.. code-block:: php

// config/packages/framework.php
$container->setParameter('env(PHP_FILE)', '../config/.runtime-evaluated.php');
$container->loadFromExtension('app', [
'auth' => '%env(require:AUTH_FILE)%',
]);

.. versionadded:: 4.3

The ``require`` processor was introduced in Symfony 4.3.

``env(trim:FOO)``
Trims the content of ``FOO`` env var, removing whitespaces from the beginning
and end of the string. This is especially useful in combination with the
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.