DependencyInjection Component
The DependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upThis PR was merged into the 4.3-dev branch. Discussion ---------- [DI] Add an url EnvProcessor | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11128 This PR add a new env processor `url` to convert an URL (or DSN) into an array. The main goal is to simplify the project configuration and reduce the number of env variable when working with bundle which are not able to deal with DSN (pick some random project in symfony/recipes-contrib: https://github.com/symfony/recipes-contrib/blob/master/facile-it/mongodb-bundle/0.6/manifest.json or https://github.com/symfony/recipes-contrib/blob/master/wouterj/eloquent-bundle/1.0/manifest.json) ```yaml # before MONGODB_HOST=localhost MONGODB_PORT=27017 MONGODB_USER= MONGODB_PASSWORD= MONGODB_DB=symfony mongo_db_bundle: data_collection: '%kernel.debug%' clients: default: hosts: - { host: '%env(MONGODB_HOST)%', port: '%env(int:MONGODB_PORT)%' } username: '%env(MONGODB_USER)%' password: '%env(MONGODB_PASSWORD)%' connectTimeoutMS: 3000 connections: default: database_name: '%env(MONGODB_DB)%' # after MONGODB_DSN=mongodb://localhost:27017/symfony mongo_db_bundle: data_collection: '%kernel.debug%' clients: default: hosts: - { host: '%env(key:host:url:MONGODB_DSN)%', port: '%env(key:port:url:MONGODB_DSN)%' } username: '%env(key:user:url:MONGODB_DSN)%' password: '%env(key:pass:url:MONGODB_DSN)%' connectTimeoutMS: 3000 connections: default: database_name: '%env(key:path:url:MONGODB_DSN)%' ``` Added also a `query_string` processor to parse query string ``` DATABASE_DSN=mysql://localhost/db?charset=utf8 foo: bar: charset: '%env(key:charset:query_string🔑 query:url:DATABASE_DSN)%' ``` Commits ------- f253c9b7ca Add an url EnvProcessor
| Type | Name | Latest commit message | Commit time |
|---|---|---|---|
| Failed to load latest commit information. | |||
|
|
Argument |
|
|
|
|
Compiler |
|
|
|
|
Config |
|
|
|
|
Dumper |
|
|
|
|
Exception |
|
|
|
|
Extension |
|
|
|
|
LazyProxy | ||
|
|
Loader |
|
|
|
|
ParameterBag |
|
|
|
|
Tests | ||
|
|
.gitignore | ||
|
|
Alias.php | ||
|
|
CHANGELOG.md | ||
|
|
ChildDefinition.php |
|
|
|
|
Container.php | ||
|
|
ContainerAwareInterface.php | ||
|
|
ContainerAwareTrait.php |
|
|
|
|
ContainerBuilder.php | ||
|
|
ContainerInterface.php | ||
|
|
Definition.php | ||
|
|
EnvVarProcessor.php | ||
|
|
EnvVarProcessorInterface.php | ||
|
|
ExpressionLanguage.php | ||
|
|
ExpressionLanguageProvider.php | ||
|
|
LICENSE | ||
|
|
Parameter.php | ||
|
|
README.md | ||
|
|
Reference.php |
|
|
|
|
ResettableContainerInterface.php | ||
|
|
ReverseContainer.php | ||
|
|
ServiceLocator.php | ||
|
|
ServiceSubscriberInterface.php | ||
|
|
TaggedContainerInterface.php |
|
|
|
|
TypedReference.php | ||
|
|
Variable.php | ||
|
|
composer.json | ||
|
|
phpunit.xml.dist |