PHPackages                             aviator/array-fold - 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. aviator/array-fold

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

aviator/array-fold
==================

Fold all elements of a multidimentional array down to a single level.

0.1.0(8y ago)219MITPHPPHP &gt;=7.0.0

Since Nov 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/danielsdeboer/array-fold)[ Packagist](https://packagist.org/packages/aviator/array-fold)[ Docs](https://github.com/danielsdeboer/array-fold)[ RSS](/packages/aviator-array-fold/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d8fa086b5be13554dec280d3cf547942bebb6e4dff311212f33c0567f928453b/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f61727261792d666f6c642f762f737461626c65)](https://packagist.org/packages/aviator/array-fold)[![License](https://camo.githubusercontent.com/af69a738d6465e312b36f07a3e10b7962017a0d9d91e5af127fc8d82bc751594/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f61727261792d666f6c642f6c6963656e7365)](https://packagist.org/packages/aviator/array-fold)[![Build Status](https://camo.githubusercontent.com/a00cd26369fbf25ce4ac21dbb168c7a07648f491c52095915fa9cbeae2de4a62/68747470733a2f2f7472617669732d63692e6f72672f64616e69656c736465626f65722f61727261792d666f6c642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danielsdeboer/array-fold)

Overview
--------

[](#overview)

`array_fold()` takes an multidimensional array of any depth and recursively folds each level into the previous, flattening it to a single level.

By default it preserves (and overwrites) keys, though this can be disabled with the optional second parameter.

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

[](#installation)

Via Composer:

```
composer require aviator/array-fold

```

Testing
-------

[](#testing)

Via Composer:

```
composer test

```

Usage
-----

[](#usage)

```
$array = [
    'level1' [
        'some' => 'value',
        'someOther' => 'value',
        'level2' => [
            'someOther' => 'value'
        ]
    ]
];

// Using keys
echo array_fold($array);

/*
 [
    'some' => 'value',
    'someOther' => 'value',
 ]
*/

// Ignoring keys
echo array_fold($array, false);

/*
 [
    'value',
    'value',
    'value',
 ]
*/
```

Other
-----

[](#other)

### License

[](#license)

This package is licensed with the [MIT License (MIT)](LICENSE.md).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3092d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebd3fe214b5768e700ae43c7fdc4b83d249972a6a97a0faef372d0ec19256eca?d=identicon)[danielsdeboer](/maintainers/danielsdeboer)

---

Top Contributors

[![danielsdeboer](https://avatars.githubusercontent.com/u/13170241?v=4)](https://github.com/danielsdeboer "danielsdeboer (2 commits)")

---

Tags

arraysflattenphpphp7phpfunctionalarraysPHP7

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aviator-array-fold/health.svg)

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

###  Alternatives

[lambdish/phunctional

λ PHP functional library

3612.0M23](/packages/lambdish-phunctional)[mpetrovich/dash

A functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.

10428.9k1](/packages/mpetrovich-dash)[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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