PHPackages                             stdakov/config - 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. stdakov/config

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stdakov/config
==============

Powerful tool for configurations

012PHP

Since May 19Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

config
======

[](#config)

This is powerful configuration tool to manage every configuration file. ##Supported files: ini,php,json

\##Installation The preferred way to install this tool is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require stdakov/config:dev-master

```

or add

```
"stdakov/config": "dev-master"

```

\##Usage For example we will have 3 configuration files in config dir: 'ini.ini' 'php.php' 'json.json'

```
require 'vendor/autoload.php';

$configFolder = 'config';
$helpersFolder = 'helpers';

$config = new \Dakov\Config();
```

We can also load helper functions if we have.

```
$config->loadHelpers($helpersFolder);
```

Lets load our configurations

```
$config->loadConfigs($configFolder);

print_r($config->listConfigs());

//This is file configuration names which are loaded
```

Output

```
Array
(
    [0] => ini
    [1] => json
    [2] => php
)

```

\------------------INI--Configuration-----------------------

```
print_r($config->load('ini')->get()->value());
print_r($config->load('ini')->get('database')->value());
try {
    print_r($config->load('ini')->get('server')->value());
} catch (\Exception $e) {
    var_dump($e->getMessage());
}

try {
    print_r($config->load('app')->get('server')->value());
} catch (\Exception $e) {
    var_dump($e->getMessage());
}

$config->load('ini')->get('database')->value()['DB_HOST'] == $config->load('ini')->get('database')->get('DB_HOST')->value();
```

Will output

```
Array
(
    [database] => Array
        (
            [DB_HOST] => localhost
            [DB_DATABASE] => test
            [DB_USERNAME] => root
            [DB_PASSWORD] => test
        )

    [admin authentication] => Array
        (
            [ADMIN_AUTH] => 1
            [ADMIN_TABLE] => admin
        )

    [upload] => Array
        (
            [tmp_dir] => /tmp
            [upload_dir] => /public/storage
        )

)
Array
(
    [DB_HOST] => localhost
    [DB_DATABASE] => test
    [DB_USERNAME] => root
    [DB_PASSWORD] => test
)
string(21) "Missing option:server"
string(25) "Missing Configuration:app"

```

\------------------JSON--Configuration-----------------------

```
print_r($config->load('json')->get()->value());
print_r($config->load('json')->get('name')->value());
```

Will output

```
Array
(
    [name] => stuff
    [components] => Array
        (
            [Version] => Array
                (
                    [versions] => 1
                )

            [Source] => Array
                (
                    [ip] => 0.0.0.1
                )

            [Empty] => Array
                (
                )

        )

)
stuff

```

\------------------PHP--Configuration-----------------------

```
print_r($config->load('php')->get()->value());
print_r($config->load('php')->get('test')->value());
```

Will output

```
Array
(
    [test] => Array
        (
            [show] => this is test
        )

)
Array
(
    [show] => this is test
)

```

\------------------Custom Configuration-------------------------

```
$configData = [
    'user'     => 'username',
    'password' => 'password'
];

$config->set($configData, 'custom');
print_r($config->load('custom')->get()->value());
print_r($config->load('custom')->get('user')->value());
```

Will output

```
Array
(
    [user] => username
    [password] => password
)
username
-------------------------------------------

```

\-------------------Custom dir-INI-----------------------

```
$customConfigPath = 'config/new/ini2.ini';
$config->registerConfig($customConfigPath);
print_r($config->load('ini2')->get()->value());
print_r($config->load('ini2')->get('database')->value());
```

Will output

```
Array
(
    [database] => Array
        (
            [DB_HOST] => localhost
            [DB_DATABASE] => test
            [DB_USERNAME] => root
            [DB_PASSWORD] => test
        )

    [admin authentication] => Array
        (
            [ADMIN_AUTH] => 1
            [ADMIN_TABLE] => admin
        )

    [upload] => Array
        (
            [tmp_dir] => /tmp
            [upload_dir] => /public/storage
        )

)
Array
(
    [DB_HOST] => localhost
    [DB_DATABASE] => test
    [DB_USERNAME] => root
    [DB_PASSWORD] => test
)
string(21) "Missing option:server"
string(26) "Missing Configuration:app2"

```

\-------------------Custom dir-INI-with custom name----------------------

```
$customConfigPath = 'config/new/ini2.ini';
$config->registerConfig($customConfigPath, 'myIni');
print_r($config->load('myIni')->get()->value());
print_r($config->load('myIni')->get('database')->value());
```

Will output

```
Array
(
    [database] => Array
        (
            [DB_HOST] => localhost
            [DB_DATABASE] => test
            [DB_USERNAME] => root
            [DB_PASSWORD] => test
        )

    [admin authentication] => Array
        (
            [ADMIN_AUTH] => 1
            [ADMIN_TABLE] => admin
        )

    [upload] => Array
        (
            [tmp_dir] => /tmp
            [upload_dir] => /public/storage
        )

)
Array
(
    [DB_HOST] => localhost
    [DB_DATABASE] => test
    [DB_USERNAME] => root
    [DB_PASSWORD] => test
)
string(21) "Missing option:server"
string(21) "Missing option:server"

```

For working examples see the tests/example.php

\##TODO 1.Implement xml files 2.Add functionality $config-&gt;load('ini2')-&gt;get('database.host')-&gt;value();

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7be3a6670043ef598a1f64ecadb2eac788f4e985090fe2919bf1bfc7ff220abd?d=identicon)[stdakov](/maintainers/stdakov)

---

Top Contributors

[![stdakov](https://avatars.githubusercontent.com/u/13567110?v=4)](https://github.com/stdakov "stdakov (1 commits)")

### Embed Badge

![Health badge](/badges/stdakov-config/health.svg)

```
[![Health](https://phpackages.com/badges/stdakov-config/health.svg)](https://phpackages.com/packages/stdakov-config)
```

###  Alternatives

[mnito/round-robin

Round-robin schedule generation implementation in PHP

6171.2k](/packages/mnito-round-robin)[darrynten/watson-personality-insights-php

PHP Watson Personality Insights Client with Extras

141.4k](/packages/darrynten-watson-personality-insights-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
