Skip to content

Commit 2920c4e

Browse files
committed
added Known issues to readme
1 parent 43c0d3c commit 2920c4e

1 file changed

Lines changed: 38 additions & 6 deletions

File tree

docs/readme/Usage.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
List your config files in `composer.json` like this:
1+
List your config files in `composer.json` like the following:
22

33
```json
44
"extra": {
55
"config-plugin": {
6-
"defines": [
7-
"?src/config/defines-local.php",
8-
"src/config/defines.php"
9-
],
106
"params": [
117
"src/config/params.php",
128
"?src/config/params-local.php"
@@ -17,7 +13,22 @@ List your config files in `composer.json` like this:
1713
},
1814
```
1915

20-
Use assembled configs like this:
16+
Define your configs like this:
17+
18+
```php
19+
<?php
20+
return [
21+
'components' => [
22+
'db' => [
23+
'class' => \my\Db::class,
24+
'name' => $params['db.name'],
25+
'password' => $params['db.password'],
26+
],
27+
],
28+
];
29+
```
30+
31+
To load assembled configs in your application use require:
2132

2233
```php
2334
$config = require hiqdev\composer\config\Builder::path('hisite');
@@ -30,10 +41,13 @@ I.e. on `install`, `update` and `dump-autoload` commands.
3041

3142
So configs are just ready to use after packages installation
3243
or updating. And to reassemble configs manually run:
44+
3345
```sh
3446
composer dump-autoload
3547
```
3648

49+
Can be shortened to `composer du`.
50+
3751
Also, you can force config rebuild from your application like this:
3852

3953
```php
@@ -56,3 +70,21 @@ behavior:
5670
- parameters from `params`
5771
- configs are processed last of all
5872

73+
# Known issues
74+
75+
This plugin treats configs as simple PHP arrays, no specific
76+
structure or semantics are expected and handled.
77+
It is simple and straightforward, but I'm in doubt...
78+
79+
Anonymous functions must be used in multiline form:
80+
81+
```php
82+
<?php
83+
return [
84+
'works' => function () {
85+
return 'value';
86+
},
87+
// this will not work
88+
'noway' => function () { return 'value'; },
89+
];
90+
```

0 commit comments

Comments
 (0)