PHPackages                             shudrum/array-finder - 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. shudrum/array-finder

ActiveLibrary

shudrum/array-finder
====================

ArrayFinder component

v1.1.0(10y ago)142.8M—0.1%9[1 issues](https://github.com/Shudrum/ArrayFinder/issues)6MITPHPPHP &gt;=5.4CI failing

Since Dec 10Pushed 3y ago2 watchersCompare

[ Source](https://github.com/Shudrum/ArrayFinder)[ Packagist](https://packagist.org/packages/shudrum/array-finder)[ Docs](https://github.com/Shudrum/ArrayFinder)[ RSS](/packages/shudrum-array-finder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (6)

[![Build Status](https://camo.githubusercontent.com/12b14a1fd211d7a29511c48c43c1a52a5b937c8cc120bc6737e287ee36e79688/68747470733a2f2f7472617669732d63692e6f72672f5368756472756d2f417272617946696e6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Shudrum/ArrayFinder)

ArrayFinder Component
=====================

[](#arrayfinder-component)

The ArrayFinder component allow you to manage large nested arrays with ease.

Here is a simple example that shows how to easily get a value from an array:

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([
    'level_1' => [
        'level_2' => [
            'level_3' => 'value',
        ],
    ],
]);

$myValue = $arrayFinder->get('level_1.level_2.level_3');
// OR
$myValue = $arrayFinder['level_1.level_2.level_3'];
```

To install this package, you can simply use composer:

```
composer require shudrum/array-finder

```

Documentation
-------------

[](#documentation)

### Methods

[](#methods)

#### get($path)

[](#getpath)

You can get a value following a path separated by a '.'.

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([
    'a' => [
        'b' => [
            'c' => 'value1',
        ],
        'value2',
    ],
    'value3',
]);

$myValue = $arrayFinder->get('a.b.c'); // value1
$myValue = $arrayFinder->get('a.0'); // value2
$myValue = $arrayFinder->get(0); // value3
```

If the path is `null`, all the content will be returned.

#### set($path, $value)

[](#setpath-value)

You can add a value to a specific path separated by a '.'. If the nested arrays does not exists, it will be created.

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder();
$arrayFinder->set('a.b', 'value');

$arrayFinder->get(); // ['a' => ['b' => 'value]]
```

#### changeSeparator($separator)

[](#changeseparatorseparator)

If the default separator (.) does not fit to your needs, you can call this method to change it.

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([…]);

$myValue = $arrayFinder->changeSeparator('/');
$myValue = $arrayFinder->get('a/b/c');
```

### Implementations

[](#implementations)

The ArrayFinder component implements some usefull interfaces:

#### ArrayAccess

[](#arrayaccess)

You can use this object like an array:

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([…]);

$value = $arrayFinder['a.b'];
$arrayFinder['a.b.c'] = 'value';
unset($arrayFinder['a.b']);
```

#### Countable

[](#countable)

You can use count on this object:

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([…]);

count($arrayFinder);
count($arrayFinder['a.b']);
```

#### Iterator

[](#iterator)

You can iterate on this object:

```
use Shudrum\Component\ArrayFinder\ArrayFinder;

$arrayFinder = new ArrayFinder([…]);

foreach ($arrayFinder as $key => $value) {
    // …
}
```

#### Serializable

[](#serializable)

You can easily serialize / unserialize this object.

\##Resources

You can run the unit tests with the following command:

```
$ cd path/to/Shudrum/Component/ArrayFinder/
$ composer install
$ phpunit

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 73.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

Every ~26 days

Total

3

Last Release

3759d ago

### Community

Maintainers

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

---

Top Contributors

[![Shudrum](https://avatars.githubusercontent.com/u/2795733?v=4)](https://github.com/Shudrum "Shudrum (11 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (2 commits)")[![djfm](https://avatars.githubusercontent.com/u/1460499?v=4)](https://github.com/djfm "djfm (1 commits)")[![mickaelandrieu](https://avatars.githubusercontent.com/u/1247388?v=4)](https://github.com/mickaelandrieu "mickaelandrieu (1 commits)")

### Embed Badge

![Health badge](/badges/shudrum-array-finder/health.svg)

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

PHPackages © 2026

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