Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 3.3 |
TLDR; DI\YamlFileLoader
is practically DI\ArrayLoader + Yaml::parse
. Lets separate those for better reuseability allowing a PhpArrayFileLoader
just as easy.
Not sure it's really worth it, but would it be nice to write a configuration definition for the DI (loader) component? Integrating the config component.
Right now only XML has a real definition with XSD. But if we add a base Loader
and Configuration
class, i see several benefits;
-
Having 1 base class that can map a normalized array to the
ContainerBuilder
. This would clean up YAML, XML loaders drastically. As they only need to supply the array in de-normalized form from file. -
All the benefits from the config component in terms of maintaining the (true) definition, normalizing and validating.
-
Allow more specific/custom loaders to be added easily, for example. i really miss a
PhpFileLoader
that handles configuration from arrays, allowing serialization etc.
// config.php
return [
'parameters' => [
'key' => 'value',
],
'services' => [
// ...
],
];
This would work for bundle configuration as well.
Any thoughts?