Skip to content

Commit 2df2303

Browse files
committed
minor #16610 [Routing] doc for env() function in route condition (GromNaN)
This PR was merged into the 5.4 branch. Discussion ---------- [Routing] doc for env() function in route condition Fix #13247 for symfony/symfony#35747 Very useful to match host based on env var. ```yaml blog_list: path: /blog # the controller value has the format 'controller_class::method_name' controller: App\Controller\BlogController::list condition: "context.getHost() == env('APP_MAIN_HOST')" ``` Commits ------- c22dc20 Documentation for env() function in route condition
2 parents 882bf92 + c22dc20 commit 2df2303

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routing.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ and can use any of these variables created by Symfony:
414414
The :ref:`Symfony Request <component-http-foundation-request>` object that
415415
represents the current request.
416416

417+
Additionnal functions are provided:
418+
419+
``env(string $name)``
420+
Read a variable using :doc:`Environment Variable Processors <configuration/env_var_processors>`
421+
417422
Behind the scenes, expressions are compiled down to raw PHP. Because of this,
418423
using the ``condition`` key causes no extra overhead beyond the time it takes
419424
for the underlying PHP to execute.

0 commit comments

Comments
 (0)