PHPackages                             kaiseki/nested-array - 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/nested-array

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

kaiseki/nested-array
====================

Recursively merge nested arrays (deep merge).

1.0.0(1mo ago)06041MITPHPPHP ^8.2CI passing

Since May 29Pushed 3w ago2 watchersCompare

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

READMEChangelog (1)Dependencies (9)Versions (3)Used By (1)

kaiseki/nested-array
====================

[](#kaisekinested-array)

Recursively merge nested arrays — a small, dependency-free deep-merge utility.

String keys are merged recursively (nested arrays are combined rather than replaced), while integer-keyed values are appended. This makes it well suited to merging layered configuration, where later sources override earlier ones but lists accumulate.

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

[](#installation)

```
composer require kaiseki/nested-array
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

```
use Kaiseki\Utility\NestedArray;

$merger = new NestedArray();

$result = $merger->mergeDeep(
    [
        'db'      => ['host' => 'localhost', 'port' => 3306],
        'plugins' => ['seo'],
    ],
    [
        'db'      => ['port' => 5432],
        'plugins' => ['cache'],
    ],
);

// [
//     'db'      => ['host' => 'localhost', 'port' => 5432],
//     'plugins' => ['seo', 'cache'],
// ]
```

`mergeDeep()` accepts any number of arrays and merges them left to right.

### Merge rules

[](#merge-rules)

- **String key, array value** — merged recursively.
- **String key, scalar value** — the value from the last array wins.
- **Integer key** — appended, so sequential/list arrays are concatenated rather than merged by index.

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

[](#development)

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

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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

Unknown

Total

1

Last Release

35d ago

### Community

Maintainers

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

---

Top Contributors

[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (7 commits)")[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (4 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

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[flagsmith/flagsmith-php-client

18806.3k2](/packages/flagsmith-flagsmith-php-client)

PHPackages © 2026

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