File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,41 @@ Symfony provides the following env var processors:
136
136
'http_method_override' => '%env(bool:HTTP_METHOD_OVERRIDE)%',
137
137
]);
138
138
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 returned as ``true ``, truthy values are returned as ``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
+
139
174
``env(int:FOO) ``
140
175
Casts ``FOO `` to an int.
141
176
You can’t perform that action at this time.
0 commit comments