This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +73
-2
lines changed Expand file tree Collapse file tree 3 files changed +73
-2
lines changed Original file line number Diff line number Diff line change
1
+ < div class ="container ">
2
+ < div class ="jumbotron ">
3
+ < h1 > zend-config-aggregator-modulemanager</ h1 >
4
+
5
+ < p > Consume zend-mvc modules as configuration providers within
6
+ zend-config-aggregator.</ p >
7
+
8
+ < pre > < code class ="language-bash "> $ composer require zendframework/zend-config-aggregator-modulemanager</ code > </ pre >
9
+ </ div >
10
+ </ div >
Original file line number Diff line number Diff line change
1
+ # Usage
2
+
3
+ This package ships with a [ zend-config-aggregator provider] ( https://docs.zendframework.com/zend-config-aggregator/config-providers/ )
4
+ that allows you to use ` Module ` classes as configuration providers in
5
+ applications backed by ` Zend\ConfigAggregator\ConfigAggregator ` .
6
+
7
+ As an example, consider the following ` Module ` class:
8
+
9
+ ``` php
10
+ namespace My\Zend\MvcModule;
11
+
12
+ class Module
13
+ {
14
+ public function getConfig()
15
+ {
16
+ return [
17
+ 'service_manager' => [
18
+ 'invokables' => [
19
+ Service\MyService::class => Service\MyService::class,
20
+ ],
21
+ ],
22
+ ];
23
+ }
24
+ }
25
+ ```
26
+
27
+ When defining configuration for your application, you can use the class
28
+ ` Zend\ConfigAggregatorModuleManager\ZendModuleProvider ` to wrap the module and
29
+ use it as a configuration provider:
30
+
31
+ ``` php
32
+ use Zend\ConfigAggregator\ConfigAggregator;
33
+ use Zend\ConfigAggregatorModuleManager\ZendModuleProvider;
34
+ use My\Zend\MvcModule\Module as MyZendMvcModule;
35
+
36
+ $aggregator = new ConfigAggregator([
37
+ new ZendModuleProvider(new MyZendMvcModule()),
38
+ ]);
39
+
40
+ var_dump($aggregator->getMergedConfig());
41
+ ```
42
+
43
+ Using this provider, the ` Module ` class is being parsed for
44
+ ` zendframework/zend-modulemanager ` interfaces or methods in exactly the same way as
45
+ performed in zend-mvc applications.
46
+
47
+ The resultant output of the above example would be:
48
+
49
+ ``` php
50
+ array(1) {
51
+ 'dependencies' =>
52
+ array(1) {
53
+ 'invokables' =>
54
+ array(1) {
55
+ 'My\Zend\MvcModule\Service\MyService' =>
56
+ string(35) "My\Zend\MvcModule\Service\MyService"
57
+ }
58
+ }
59
+ }
60
+ ```
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ docs_dir: docs/book
3
3
site_dir : docs/html
4
4
pages :
5
5
- index.md
6
- site_description : ' zendframework/zend-modulemanager extension for the zendframework/zend-config-aggregator package.'
6
+ - Usage : usage.md
7
+ site_description : ' Consume zend-mvc modules as configuration providers within zend-config-aggregator.'
7
8
repo_url : ' https://github.com/zendframework/zend-config-aggregator-modulemanager'
8
- copyright : ' Copyright (c) 2016- 2018 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>'
9
+ copyright : ' Copyright (c) 2018 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>'
You can’t perform that action at this time.
0 commit comments