项目作者: zendframework

项目描述 :
Consume zend-mvc modules as configuration providers within zend-config-aggregator.
高级语言: PHP
项目地址: git://github.com/zendframework/zend-config-aggregator-modulemanager.git


zend-config-aggregator-modulemanager

Repository abandoned 2019-12-31

This repository has moved to laminas/laminas-config-aggregator-modulemanager.

Build Status
Coverage Status

Provides an extension to the zendframework/zend-config-aggregator so zendframework/zend-mvc
modules can be parsed into the new config structure, e.g. for zendframework/zend-expressive
or other projects.

Usage

  1. use Zend\ConfigAggregator\ConfigAggregator;
  2. use Zend\ConfigAggregatorModuleManager\ZendModuleProvider;
  3. use My\Zend\MvcModule\Module as MyZendMvcModule;
  4. namespace My\Zend\MvcModule
  5. {
  6. class Module
  7. {
  8. public function getConfig()
  9. {
  10. return [
  11. 'service_manager' => [
  12. 'invokables' => [
  13. Service\MyService::class => Service\MyService::class,
  14. ],
  15. ],
  16. ];
  17. }
  18. }
  19. }
  20. namespace My\Zend\MvcModule\Service {
  21. class MyService
  22. {
  23. }
  24. }
  25. $aggregator = new ConfigAggregator([
  26. new ZendModuleProvider(new MyZendMvcModule()),
  27. ]);
  28. var_dump($aggregator->getMergedConfig());

Using this provider, the Module class is being parsed for zendframework/zend-modulemanager interfaces or methods.
Just the same way as zendframework/zend-mvc does. Therefore, the output of the example would be:

  1. array(1) {
  2. 'dependencies' =>
  3. array(1) {
  4. 'invokables' =>
  5. array(1) {
  6. 'My\Zend\MvcModule\Service\MyService' =>
  7. string(35) "My\Zend\MvcModule\Service\MyService"
  8. }
  9. }
  10. }

For more details, please refer to the documentation.