PHPackages                             chilimatic/config-component - 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. [Framework](/categories/framework)
4. /
5. chilimatic/config-component

ActiveLibrary[Framework](/categories/framework)

chilimatic/config-component
===========================

config component within the chilimatic framework

2.1.0(9y ago)0751MITPHPPHP &gt;=7

Since Jun 14Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (12)Used By (1)

config-component
================

[](#config-component)

chilimatic config-component

The File Object is built for multi-domain architectures:

The idea is pretty simple you create a config directory, every config file has the extension `.cfg` the object will created a list based on the given host\_id of the server. if no host\_id is set as parameter it will try to determinate the id via `$_SERVER ['HTTP_HOST']`or it will try to look for the `host` parameter use from the cli

```
php myscript.php host=www.example.com
```

if still no host\_id is found it will throw an exception.

```
$config = new File(
    [
        \chilimatic\lib\Config\Adapter\File::CONFIG_PATH_INDEX  => __DIR__ . '/test/data',
        \chilimatic\lib\Config\Adapter\File::HOST_ID_KEY        => 'www.example.com'
    ]
);
```

It will than generate a set of possible configs based on the delimiter, the delimiter is `*` by default you can switch it to `all` for windows machines.

the generated set in our case would look as follows:

```
[
    '*.cfg',
    '*.example.com.cfg',
    'www.example.com.cfg'
]
```

as mentioned you can change the delimiter for windows machines to `all`

```
[
    'all.cfg',
    'all.example.com.cfg',
    'www.example.com.cfg'
]
```

the \*.cfg will be used on every system, and than it will be overwritten hierarchical

The values are stored in a doublylinked-list so all values do remain but in general the config returns the last appended value to a specific key

```
$config = new File(
    [
        \chilimatic\lib\Config\Adapter\File::CONFIG_PATH_INDEX  => __DIR__ . '/test/data',
        \chilimatic\lib\Config\Adapter\File::HOST_ID_KEY        => 'www.example.com'
    ]
);
$config->set('key1', ['some', 'data']);
$config->set('key1', implode(' ', $config->get('key1')));

echo $config->get('key1'); // will return 'some data'
```

the config implements its own parser which allows you to write configs like

```
#cache settings
cache_type = 'memcached'
cache_settings = { "server_list" : [{"host" : "127.0.0.1", "port" : "11211", "weight" : 1 }] }
// it is possible to read serialized data but as we all know this can lead to chaos :)
// so stick to json if possible
serializedString = a:2:{s:2:"my";s:3:"key";s:5:"value";O:8:"stdClass":0:{}}

```

comments are defined as `// or #` and will be added to the node;

The library includes a standard factory pattern that can be accessed static

```
\chilimatic\lib\Config\ConfigFactory::make(
    'file',
     [
             \chilimatic\lib\Config\Adapter\File::CONFIG_PATH_INDEX  => __DIR__ . '/test/data',
             \chilimatic\lib\Config\Adapter\File::HOST_ID_KEY        => 'www.example.com'
     ]
 ); // returns the same as the example above
```

As well as a singelton config wrapper which utilizes the factory to create a config that allows you static access.

```
// passed reference
$config = \chilimatic\lib\Config\Config::getInstance(
    'file',
     [
             \chilimatic\lib\Config\Adapter\File::CONFIG_PATH_INDEX  => __DIR__ . '/test/data',
             \chilimatic\lib\Config\Adapter\File::HOST_ID_KEY        => 'www.example.com'
     ]
 );
// also accessable via
Config::set('my variable', 'my value);
Config::get('my variable');
```

you can have a look at the benchmark.php and the unit tests.

if you just wanna uses ini files you can use the ini adapter

```
$config = new \chilimatic\lib\Config\Adapter\Ini(
    [
         \chilimatic\lib\Config\Adapter\Ini::FILE_INDEX => __DIR__ . '/test/data/'
    ]
);
```

if you just pass a directory it will scan for all files with an `.ini` extension It will merge them recursive based on the scanned order. and than pass it to the node graph structure inside of the config object

if you pass a specific file it will only use this file.

Planned for the next steps are new engines right now it's a dom like structure with indexes this can be overkill and maybe other people prefer a flat hashmap structure.
Maybe a json adapter will be cool too.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~5 days

Total

10

Last Release

3571d ago

Major Versions

1.0.2 → 2.0.02016-06-29

PHP version history (2 changes)1.0.0PHP &gt;=5.4

2.0.0PHP &gt;=7

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e54bb15e79f8e0a58c1c541ba033d180bf511554046e700f5d456f7c66518ab?d=identicon)[chilimatic](/maintainers/chilimatic)

---

Top Contributors

[![chilimatic](https://avatars.githubusercontent.com/u/6705416?v=4)](https://github.com/chilimatic "chilimatic (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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