File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,46 @@ Symfony provides the following env var processors:
136136 'http_method_override' => '%env(bool:HTTP_METHOD_OVERRIDE)%',
137137 ]);
138138
139+ ``env(not:FOO) ``
140+
141+ .. versionadded :: 5.3
142+
143+ The ``not: `` env var processor was introduced in Symfony 5.3.
144+
145+ Casts ``FOO `` to a bool (just as ``env(bool:...) `` does) except it returns the inverted value
146+ (falsy values are returned as ``true ``, truthy values are returned as ``false ``):
147+
148+ .. configuration-block ::
149+
150+ .. code-block :: yaml
151+
152+ # config/services.yaml
153+ parameters :
154+ safe_for_production : ' %env(not:APP_DEBUG)%'
155+
156+ .. code-block :: xml
157+
158+ <!-- config/services.xml -->
159+ <?xml version =" 1.0" encoding =" UTF-8" ?>
160+ <container xmlns =" http://symfony.com/schema/dic/services"
161+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
162+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
163+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
164+ https://symfony.com/schema/dic/services/services-1.0.xsd
165+ http://symfony.com/schema/dic/symfony
166+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
167+
168+ <parameters >
169+ <parameter key =" safe_for_production" >%env(not:APP_DEBUG)%</parameter >
170+ </parameters >
171+
172+ </container >
173+
174+ .. code-block :: php
175+
176+ // config/services.php
177+ $container->setParameter('safe_for_production', '%env(not:APP_DEBUG)%');
178+
139179 ``env(int:FOO) ``
140180 Casts ``FOO `` to an int.
141181
You can’t perform that action at this time.
0 commit comments