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

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

kaiseki/config
==============

Type-safe access to array configurations

2.1.0(3w ago)03.2k20MITPHPPHP ^8.2CI passing

Since Apr 26Pushed 3w ago2 watchersCompare

[ Source](https://github.com/kaisekidev/kaiseki-config)[ Packagist](https://packagist.org/packages/kaiseki/config)[ Docs](https://github.com/kaisekidev/kaiseki-config)[ RSS](/packages/kaiseki-config/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (38)Versions (15)Used By (20)

kaiseki/config
==============

[](#kaisekiconfig)

Type-safe access to array configurations, with dot-notation paths.

Wrap a config array (or pull one from a PSR-11 container) and read values with typed accessors that throw on a missing key or a wrong type — so a typo or a misconfigured value fails loudly instead of silently returning `null`.

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

[](#installation)

```
composer require kaiseki/config
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

```
use Kaiseki\Config\NestedArrayConfig;

$config = new NestedArrayConfig([
    'db' => [
        'host' => 'localhost',
        'port' => 3306,
    ],
]);

$config->string('db.host'); // "localhost"
$config->int('db.port');    // 3306
$config->has('db.user');    // false
```

Paths are dot-separated. Typed getters (`string()`, `int()`, `float()`, `bool()`, `array()`) throw `UnknownKeyException` if the path is missing and `InvalidValueException` if the value is not of the expected type.

### Defaults and nullables

[](#defaults-and-nullables)

```
$config->string('db.user', 'root');      // default when the key is absent
$config->get('db.password', null, true); // allow null (nullable)
```

### Typed lists

[](#typed-lists)

`stringList()`, `intList()`, and `floatList()` read the array at a key and narrow it to a `list` / `list` / `list`, dropping any element of the wrong type and re-indexing the result:

```
$config = new NestedArrayConfig(['paths' => ['/a', 42, '/b']]);

$config->stringList('paths'); // ['/a', '/b']  — the 42 is dropped, keys re-indexed
```

They behave like `array()` for the key itself: a missing key throws `UnknownKeyException` and a non-array value throws `InvalidValueException`, unless a default list is supplied:

```
$config->stringList('paths', []); // [] when the key is absent
```

### String-keyed maps

[](#string-keyed-maps)

`stringKeyedArray()` narrows the array at a key to an `array`, dropping any integer-keyed elements while keeping the string keys — handy for reading an options map where a stray list entry would otherwise leak in:

```
$config = new NestedArrayConfig(['opts' => ['public' => true, 0 => 'ignored', 'label' => 'X']]);

$config->stringKeyedArray('opts'); // ['public' => true, 'label' => 'X']
```

It follows the same missing-key / wrong-type rules as `array()`.

### From a PSR-11 container

[](#from-a-psr-11-container)

`Config::fromContainer()` reads the `config` entry from a container:

```
use Kaiseki\Config\Config;

$config = Config::fromContainer($container); // expects $container->get('config')
```

`Config::initClassMap()` resolves a map of keys to class instances from the container:

```
$map = Config::initClassMap($container, ['logger' => LoggerInterface::class]);
// ['logger' => ]
```

Development
-----------

[](#development)

```
composer install
composer check   # check-deps, cs-check, phpstan, phpunit
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.2% 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 ~114 days

Recently: every ~231 days

Total

11

Last Release

22d ago

Major Versions

1.7.0 → 2.0.02026-05-30

PHP version history (2 changes)1.0.0PHP ^8.1

2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c3a6b11aea9668c9e9ca0c0f8515ef114d344acb552c695d715d35d5b388ea4?d=identicon)[woda](/maintainers/woda)

---

Top Contributors

[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (30 commits)")[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k52](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M270](/packages/symfony-type-info)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

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