Skip to content

Commit ad3bb0b

Browse files
committed
minor
1 parent 2920c4e commit ad3bb0b

2 files changed

Lines changed: 41 additions & 8 deletions

File tree

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

8798
So configs are just ready to use after packages installation
8899
or updating. And to reassemble configs manually run:
100+
89101
```sh
90102
composer dump-autoload
91103
```
92104

105+
Can be shortened to `composer du`.
106+
93107
Also, 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

117150
This project is released under the terms of the BSD-3-Clause [license](LICENSE).

docs/readme/Usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ behavior:
7070
- parameters from `params`
7171
- configs are processed last of all
7272

73-
# Known issues
73+
## Known issues
7474

7575
This plugin treats configs as simple PHP arrays, no specific
7676
structure or semantics are expected and handled.
7777
It is simple and straightforward, but I'm in doubt...
7878

79-
Anonymous functions must be used in multiline form:
79+
Anonymous functions must be used in multiline form only:
8080

8181
```php
8282
<?php

0 commit comments

Comments
 (0)