Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 19, 2017
1 parent c82878b commit aaa59c6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ How it works?
in turn should be used for configs
- files processing order is crucial to achieve expected behavior: options
in root package have priority over options from included packages, more
about it later in **Files processing order** section
about it see below in **Files processing order** section
- collected configs are written as PHP files in
`vendor/hiqdev/composer-config-plugin-output`
directory together with information needed to rebuild configs on demand
directory along with information needed to rebuild configs on demand
- then assembled configs can be loaded into application with `require`

[composer]: https://getcomposer.org/
Expand Down Expand Up @@ -65,14 +65,20 @@ List your config files in `composer.json` like the following:
"src/config/params.php",
"?src/config/params-local.php"
],
"hisite": "src/config/hisite.php",
"common": "src/config/common.php",
"web": [
"$common",
"src/config/web.php"
],
"other": "src/config/other.php"
}
},
```

`?` marks optional files, absence of other files will cause exception.

`$common` is inclusion - `common` config will be merged into `web`.

Define your configs like this:

```php
Expand All @@ -90,16 +96,19 @@ return [
To load assembled configs in your application use require:

```php
$config = require hiqdev\composer\config\Builder::path('hisite');
$config = require hiqdev\composer\config\Builder::path('web');
```

### Refreshing config

Plugin hangs on composer `POST_AUTOLOAD_DUMP` event.
I.e. composer runs this plugin on `install`, `update` and `dump-autoload`
commands.
As the result configs are just ready to use after packages installation
or updating. To reassemble configs manually run:
As the result configs are just ready to be used after packages installation
or updating.

After you make changes to any of configs you may want to reassemble configs
manually - run:

```sh
composer dump-autoload
Expand Down Expand Up @@ -129,6 +138,8 @@ behavior:
- parameters from `params`
- configs are processed last of all



## Known issues

This plugin treats configs as simple PHP arrays, no specific
Expand Down
19 changes: 15 additions & 4 deletions docs/readme/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ List your config files in `composer.json` like the following:
"src/config/params.php",
"?src/config/params-local.php"
],
"hisite": "src/config/hisite.php",
"common": "src/config/common.php",
"web": [
"$common",
"src/config/web.php"
],
"other": "src/config/other.php"
}
},
```

`?` marks optional files, absence of other files will cause exception.

`$common` is inclusion - `common` config will be merged into `web`.

Define your configs like this:

```php
Expand All @@ -32,16 +38,19 @@ return [
To load assembled configs in your application use require:

```php
$config = require hiqdev\composer\config\Builder::path('hisite');
$config = require hiqdev\composer\config\Builder::path('web');
```

### Refreshing config

Plugin hangs on composer `POST_AUTOLOAD_DUMP` event.
I.e. composer runs this plugin on `install`, `update` and `dump-autoload`
commands.
As the result configs are just ready to use after packages installation
or updating. To reassemble configs manually run:
As the result configs are just ready to be used after packages installation
or updating.

After you make changes to any of configs you may want to reassemble configs
manually - run:

```sh
composer dump-autoload
Expand Down Expand Up @@ -71,6 +80,8 @@ behavior:
- parameters from `params`
- configs are processed last of all



## Known issues

This plugin treats configs as simple PHP arrays, no specific
Expand Down
4 changes: 2 additions & 2 deletions hidev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ package:
in turn should be used for configs
- files processing order is crucial to achieve expected behavior: options
in root package have priority over options from included packages, more
about it later in **Files processing order** section
about it see below in **Files processing order** section
- collected configs are written as PHP files in
`vendor/hiqdev/composer-config-plugin-output`
directory together with information needed to rebuild configs on demand
directory along with information needed to rebuild configs on demand
- then assembled configs can be loaded into application with `require`
[composer]: https://getcomposer.org/
Expand Down

0 comments on commit aaa59c6

Please sign in to comment.