PHPackages                             phpfit/config-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpfit/config-builder

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

phpfit/config-builder
=====================

Combine all configs from each phpfit packages and create or extends exists app config

1.0.2(8mo ago)04MITPHP

Since Aug 22Pushed 8mo agoCompare

[ Source](https://github.com/phpfit/config-builder)[ Packagist](https://packagist.org/packages/phpfit/config-builder)[ RSS](/packages/phpfit-config-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

phpfit/config-builder
=====================

[](#phpfitconfig-builder)

Composer plugin to get configs from all phpfit packages and combine them all to generate new config file on `BASEPATH/etc/{config.key}.php`. This module is for internal system php fit framework usage only. Nothing to do here for app developer.

This module is executed for every after package install or update.

Installation
------------

[](#installation)

```
composer require phpfit/config-builder
```

Usage
-----

[](#usage)

Add an `extra` key on your package `composer.json` file to target the package config file location:

```
{
    "...": "...",
    "extra": {
        "phpfit": {
            "config": "etc/config.php"
        }
    },
    "...": "..."
}
```

Extra name should be `phpfit.config` to be identified.

Config Strucutre
----------------

[](#config-strucutre)

Add config file on `etc/config.php` and put package config as array. The top array key will be used as config file name, and array value as config value after combining them with exists config file.

```
return [
    'db' => [
        'host' => 'localhost'
    ]
];
```

Above package config will create or modify exists app config named `etc/config/db.php`and combine the value of exists app config with provided package config. The final result of the config on `etc/config/db.php` will be as below:

```
