File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,40 @@ It is also possible to combine the processors:
237237 auth: '%env(file:resolve:AUTH_FILE)%'
238238
239239
240+ Custom Environment Variable Processors
241+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242+
243+ Its possible to add further processors for environment variables. You just need
244+ to add an implementation of `Symfony\Component\DependencyInjection\EnvVarProcessorInterface `.
245+
246+ .. code-block :: php
247+
248+ class LowercasingEnvVarProcessor implements EnvVarProcessorInterface
249+ {
250+ private $container;
251+
252+ public function __construct(ContainerInterface $container)
253+ {
254+ $this->container = $container;
255+ }
256+
257+ public function getEnv($prefix, $name, \Closure $getEnv)
258+ {
259+ $env = $getEnv($name);
260+
261+ return strtolower($env);
262+ }
263+
264+ public static function getProvidedTypes()
265+ {
266+ return [
267+ 'lowercase' => 'string',
268+ ];
269+ }
270+ }
271+
272+
273+
240274 .. _configuration-env-var-in-prod :
241275
242276Configuring Environment Variables in Production
You can’t perform that action at this time.
0 commit comments