Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Added zendframework/zend-config-aggregator-modulemanager as suggestion #18

Merged
merged 8 commits into from
Apr 4, 2018
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"zendframework/zend-servicemanager": "^2.7.7 || ^3.1.1"
},
"suggest": {
"zendframework/zend-config": "Allows loading configuration from XML, INI, YAML, and JSON files"
"zendframework/zend-config": "Allows loading configuration from XML, INI, YAML, and JSON files",
"zendframework/zend-config-aggregator-modulemanager": "Allows loading configuration from zend-mvc modules without ConfigProvider"
},
"autoload": {
"psr-4": {
Expand Down
25 changes: 15 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions docs/book/config-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,29 @@ type based on file extension.
Some config readers (in particular, YAML) may need additional dependencies;
please refer to [the zend-config manual](https://docs.zendframework.com/zend-config/reader/)
for more details.


### ZendModuleProvider

To provide configurations from old Modules which were created for `zendframework/zend-mvc` applications, you can use the `ZendModuleProvider` which is provided by the [zendframework/zend-config-aggregator-modulemanager](https://github.com/zendframework/zend-config-aggregator-modulemanager) extension.
This provider would parse the module class for the `Module::getConfig` method aswell as for the `Module::getServiceConfig` (declared by `ServiceProviderInterface`).

```bash
$ composer require zendframework/zend-config-aggregator-modulemanager
```

Once installed, you may use as many `ZendModuleProvider` instances as you need:

```php
use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregatorModuleManager\ZendModuleProvider;
use ACME;

$aggregator = new ConfigAggregator([
new ZendModuleProvider(new ACME\Module()),
]);
```

`ZendModuleProvider` accepts any object which represents the `zend-mvc`-Module. For more details, please refer
to [the zend-config-aggregator-modulemanager manual](https://docs.zendframework.com/zend-config-aggregator-modulemanager/)
for more details.