-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Add env() and EnvConfigurator in the PHP-DSL #40682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you. I like the idea. Having |
src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php
Show resolved
Hide resolved
|
src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php
Outdated
Show resolved
Hide resolved
Concerning custom env var processor and extension, WDYT of making |
7eecb14
to
765bf13
Compare
@fancyweb no need to make it protected (which would then forbid refactoring it). Your own method could call |
765bf13
to
f2bf776
Compare
f2bf776
to
5f0fe32
Compare
Thank you @fancyweb. |
…rectly on EnvConfigurator (jvasseur) This PR was merged into the 5.3-dev branch. Discussion ---------- [DependencyInjection] Allow calling custom processors directly on EnvConfigurator | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | This is a proposition of addition to the feature added by #40682 to allow calling custom processors in the same way we call builtin ones. This is not perfect since it doesn't allow auto-completion for these custom methods but I think this provides a cleaner API for custom processors. Commits ------- 1d008f7 Allow calling custom processors directly on EnvConfigurator
Recently, I have been using env var processors a lot. This is a proposition to improve the DX a bit when you use the PHP-DSL to configure services.
Firstly, I am "annoyed" by the fact that I can do
param('my_param')
but notenv('MY_ENV')
.Secondly, long chains of env var processors (eg:
%env(default:my_param:key:path:url:MY_ENV_VAR)
have two issues:Before:
After:
Custom env var processor would be callable with
->custom('my_custom_env_var_processor')
or you could extend the configurator and add your own methods.WDYT?