Closed weierophinney closed 7 years ago
Initial, proof-of-concept support is added here: #16 (with service provider caching).
I have a few issues with approach you proposed, main being complexity of ProviderAggregate
class.
What about updating ConfigManager
to iterate over service providers and returning flattened array? It is more in line with my initial ideas for this library (process objects to produce simple array). This would also simplify loading cache (single include
vs include
and unserialize
).
ContainerInjector
could then consume that flattened array directly. What do you think?
Closing - this package is now replaced by zend-config-aggregator.
I'm investigating service-provider, which is being developed as part of the PSR-11 initiative around container interoperability. It's looking like some form of this project will be what is proposed to FIG.
The basic idea is that a service provider returns a list of services, pointing to their factories. Each factory expects a container, and optionally a callback returning the instance generated by a previous factory (in zend-servicemanager terms, every factory has the potential of being a delegator factory).
I've created a project for seeding a zend-servicemanager instance from providers: phly/zend-servicemanager-interop. It has two classes, one that aggregates providers, and another that uses providers to inject a service manager instance.
I've been doing some brainstorming, and propose that the config manager check for service-providers.
In pseudo-logic, this would look something like:
The ConfigManager would then also expose a new method,
getServiceProviders()
, which would return the provider aggregate. We can then use that to seed containers.For this to work,
config/config.php
would now return theConfigManager
instance, and not the merged config. We would grab the merged configuration when injecting our container with the config service.So, the proposed path is:
getServiceProviders()
, which returns that aggregateconfig.php
file, and the implications on building containers.Thoughts?