PHPackages                             peridot-php/object-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. peridot-php/object-path

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

peridot-php/object-path
=======================

A string syntax to fetch values from array and object hierarchies

1.0.0(10y ago)1053.6k↓23.8%51MITPHPPHP &gt;=5.4.0

Since Jul 24Pushed 10y ago2 watchersCompare

[ Source](https://github.com/peridot-php/object-path)[ Packagist](https://packagist.org/packages/peridot-php/object-path)[ RSS](/packages/peridot-php-object-path/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

ObjectPath [![Build Status](https://camo.githubusercontent.com/f535ccedd42e51118e63b223673fd0792332c21cdec622989024188304c595cf/68747470733a2f2f7472617669732d63692e6f72672f70657269646f742d7068702f6f626a6563742d706174682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/peridot-php/object-path)
===============================================================================================================================================================================================================================================================================================================

[](#objectpath-)

Allows traversal of objects and arrays with a simple string syntax. Extracted from Peridot's matcher library: [Leo](https://github.com/peridot-php/leo).

Usage
-----

[](#usage)

```
$data = [
  'name' => 'Brian',
  'hobbies' => [
    'reading',
    'programming',
    'lion taming'
  ],
  'address' => [
    'street' => '1234 Lane',
    'zip' => '12345'
  ]
];

use Peridot\ObjectPath\ObjectPath;

$path = new ObjectPath($data);
$reading = $path->get('hobbies[0]');
$zip = $path->get('address[zip]');

// the result of get() is an ObjectPathValue instance
$value = $reading->getPropertyValue();

// The syntax also works for objects and nested structures

$data = new stdClass();

$data->name = 'Brian';
$data->address = new stdClass();
$data->address->zip = '12345';

$hobby = new stdClass();
$hobby->name = 'reading';
$hobby->style = 'relaxing';
$data->hobbies = [$hobby];

$path = new ObjectPath($data);
$name = $path->get('name');
$zip = $path->get('address->zip');
$reading = $path->get('hobbies[0]->name');
```

Tests
-----

[](#tests)

```
$ composer install
$ vendor/bin/peridot specs/

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

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

3951d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

arrayobjecttraversal

### Embed Badge

![Health badge](/badges/peridot-php-object-path/health.svg)

```
[![Health](https://phpackages.com/badges/peridot-php-object-path/health.svg)](https://phpackages.com/packages/peridot-php-object-path)
```

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[jasny/dotkey

Dot notation access for objects and arrays

14219.5k6](/packages/jasny-dotkey)[michaldudek/foundation

A set of useful PHP classes.

13111.9k13](/packages/michaldudek-foundation)

PHPackages © 2026

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