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

Add documentation for therequire 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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wouterj merged 1 commit intosymfony:masterfrommpdude:docs-for-30897
Apr 7, 2019
Merged
Changes fromall 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
45 changes: 45 additions & 0 deletionsconfiguration/environment_variables.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp