PHPackages                             saasformation/array-by-path - 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. saasformation/array-by-path

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

saasformation/array-by-path
===========================

Library to get/set on an array using a dotted path

1.0.0(4y ago)0221MITPHP

Since Apr 6Pushed 4y agoCompare

[ Source](https://github.com/SaaSFormationCOM/array-by-path)[ Packagist](https://packagist.org/packages/saasformation/array-by-path)[ RSS](/packages/saasformation-array-by-path/feed)WikiDiscussions main Synced today

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

ArrayByPath
===========

[](#arraybypath)

ArrayByPath is a library to get/set on an array using a dotted path

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

[](#installation)

Use composer to require the library:

```
composer require saasformation/array-by-path
```

Getting started
---------------

[](#getting-started)

Let's imagine you have the following array:

```
$array = [
    'data' => [
        'id' => '53b3ed90-b5ae-11ec-b909-0242ac120002',
        'attributes' => [
            'name' => 'John',
            'surname' => 'Smith',
            'birthdate' => '1990-01-20',
            'savings_total_amount' => [
                'amount' => 2045033,
                'currency' => 'EUR'
            ]
        ]
    ]
];
```

With ArrayByPath you get a value using a path like this:

```
$name = (new RetrieveArrayValueByPathService())->find('data.attributes.name', $array); // "John"
```

Find will always return a value or null if the path does not exist.

```
$invalidPath = (new RetrieveArrayValueByPathService())->find('foo', $array); // null
```

If you want to get an exception if the path not exists, then use get:

```
$invalidPath = (new RetrieveArrayValueByPathService())->get('foo', $array); // InvalidPathException
```

Also, you can set a new value in the array using a path, like this:

```
(new SetValueToArrayByPathService())->insert('data.attributes.height', $array, 177);
```

If the path already have a value, then a `PathAlreadyExistsException` will be thrown. If you prefer to update the value in this situation, use `upsert` instead.

Issues
------

[](#issues)

If you find some issue in the library, please feel free to open an issue here on Github.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

1548d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6607762?v=4)[Alex Hernandez](/maintainers/stratdes)[@stratdes](https://github.com/stratdes)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/saasformation-array-by-path/health.svg)

```
[![Health](https://phpackages.com/badges/saasformation-array-by-path/health.svg)](https://phpackages.com/packages/saasformation-array-by-path)
```

###  Alternatives

[willywes/agora-sdk-php

Agora.io SDK PHP

1024.0k2](/packages/willywes-agora-sdk-php)

PHPackages © 2026

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