@@ -54,15 +54,11 @@ To enable additional formats require:
5454
5555## Usage
5656
57- List your config files in ` composer.json ` like this :
57+ List your config files in ` composer.json ` like the following :
5858
5959``` json
6060"extra" : {
6161 "config-plugin" : {
62- "defines" : [
63- " ?src/config/defines-local.php" ,
64- " src/config/defines.php"
65- ],
6662 "params" : [
6763 " src/config/params.php" ,
6864 " ?src/config/params-local.php"
@@ -73,7 +69,22 @@ List your config files in `composer.json` like this:
7369},
7470```
7571
76- Use assembled configs like this:
72+ Define your configs like this:
73+
74+ ``` php
75+ <?php
76+ return [
77+ 'components' => [
78+ 'db' => [
79+ 'class' => \my\Db::class,
80+ 'name' => $params['db.name'],
81+ 'password' => $params['db.password'],
82+ ],
83+ ],
84+ ];
85+ ```
86+
87+ To load assembled configs in your application use require:
7788
7889``` php
7990$config = require hiqdev\composer\config\Builder::path('hisite');
@@ -86,10 +97,13 @@ I.e. on `install`, `update` and `dump-autoload` commands.
8697
8798So configs are just ready to use after packages installation
8899or updating. And to reassemble configs manually run:
100+
89101``` sh
90102composer dump-autoload
91103```
92104
105+ Can be shortened to ` composer du ` .
106+
93107Also, you can force config rebuild from your application like this:
94108
95109``` php
@@ -112,6 +126,25 @@ behavior:
112126 - parameters from ` params `
113127 - configs are processed last of all
114128
129+ ## Known issues
130+
131+ This plugin treats configs as simple PHP arrays, no specific
132+ structure or semantics are expected and handled.
133+ It is simple and straightforward, but I'm in doubt...
134+
135+ Anonymous functions must be used in multiline form:
136+
137+ ``` php
138+ <?php
139+ return [
140+ 'works' => function () {
141+ return 'value';
142+ },
143+ // this will not work
144+ 'noway' => function () { return 'value'; },
145+ ];
146+ ```
147+
115148## License
116149
117150This project is released under the terms of the BSD-3-Clause [ license] ( LICENSE ) .
0 commit comments