Skip to content

Commit 367fcdf

Browse files
committed
feat: add documentation for symfony/symfony#40169 (negated env var processor)
1 parent 1839389 commit 367fcdf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

configuration/env_var_processors.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,41 @@ Symfony provides the following env var processors:
136136
'http_method_override' => '%env(bool:HTTP_METHOD_OVERRIDE)%',
137137
]);
138138
139+
``env(not:FOO)``
140+
Casts ``FOO`` to a bool (just as ``env(bool:...)`` does) except it returns the inverted value
141+
(falsy values are turned to ``true``, truthy values are turned to ``false ``):
142+
143+
.. configuration-block::
144+
145+
.. code-block:: yaml
146+
147+
# config/services.yaml
148+
parameters:
149+
safe_for_production: '%env(not:APP_DEBUG)%'
150+
151+
.. code-block:: xml
152+
153+
<!-- config/services.xml -->
154+
<?xml version="1.0" encoding="UTF-8" ?>
155+
<container xmlns="http://symfony.com/schema/dic/services"
156+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
157+
xmlns:framework="http://symfony.com/schema/dic/symfony"
158+
xsi:schemaLocation="http://symfony.com/schema/dic/services
159+
https://symfony.com/schema/dic/services/services-1.0.xsd
160+
http://symfony.com/schema/dic/symfony
161+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
162+
163+
<parameters>
164+
<parameter key="safe_for_production">%env(not:APP_DEBUG)%</parameter>
165+
</parameters>
166+
167+
</container>
168+
169+
.. code-block:: php
170+
171+
// config/services.php
172+
$container->setParameter('safe_for_production', '%env(not:APP_DEBUG)%');
173+
139174
``env(int:FOO)``
140175
Casts ``FOO`` to an int.
141176

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