Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf9448d

Browse files
committed
Example of customer env var processor
1 parent67227a6 commitaf9448d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

‎configuration/external_parameters.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff 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

242276
Configuring Environment Variables in Production

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp