PHPackages                             rikta/value-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. rikta/value-path

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

rikta/value-path
================

Perform get-operations on a string-notated subvalue of an object or array

0.1.1(4y ago)0271MITPHPPHP ^7.4|^8.0CI failing

Since Sep 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/RiktaD/value-path)[ Packagist](https://packagist.org/packages/rikta/value-path)[ RSS](/packages/rikta-value-path/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (1)

ValuePath
=========

[](#valuepath)

[![packagist name](https://camo.githubusercontent.com/4702e5f4696933da2d8d523f7d18b1c2196831c0c158a303bbfa40e490616b24/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f6e616d652f72696b74612f76616c75652d70617468)](https://packagist.org/packages/rikta/value-path)[![version](https://camo.githubusercontent.com/f8d902f5295cfee98769b1ce063311e4d61093c78cbd921d521a8c7d77674093/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f72696b74612f76616c75652d706174682f6c61746573743f6c6162656c26636f6c6f723d677265656e)](https://github.com/RiktaD/value-path/releases)[![php version](https://camo.githubusercontent.com/39961467c9a2c5697719226ee245197856160c730044be784668dc8e505eea80/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f72696b74612f76616c75652d70617468)](https://github.com/RiktaD/value-path/blob/main/composer.json)

[![license](https://camo.githubusercontent.com/12cde74d7becb3a5e7a98465190943fd6adbefee5e8efc6ba6785c5a145c3f8b/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f72696b7461642f76616c75652d70617468)](https://github.com/RiktaD/value-path/blob/main/LICENSE.md)[![GitHub commit activity](https://camo.githubusercontent.com/e703cfe43fa49612fd393103113ecb716689180b9f7c2f8cc129cbeac42a110c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f72696b7461642f76616c75652d70617468)](https://github.com/RiktaD/value-path/graphs/commit-activity)[![open issues](https://camo.githubusercontent.com/445c8e33f818c93043cd2b91a2c449787f71230a5eaeea61496956398c268583/68747470733a2f2f62616467656e2e6e65742f6769746875622f6f70656e2d6973737565732f72696b7461642f76616c75652d70617468)](https://github.com/RiktaD/value-path/issues?q=is%3Aopen+is%3Aissue)[![closed issues](https://camo.githubusercontent.com/5f13f8924c19cc98a7f7352dd7308486bcaa6d00949f4357fd0f328ba2665dbb/68747470733a2f2f62616467656e2e6e65742f6769746875622f636c6f7365642d6973737565732f72696b7461642f76616c75652d70617468)](https://github.com/RiktaD/value-path/issues?q=is%3Aissue+is%3Aclosed)

[![ci](https://camo.githubusercontent.com/0def3b12655fa615987f85f260cadf0d12b2df4e81001780a2611f3b71cc07d5/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f72696b7461642f76616c75652d706174683f6c6162656c3d6369)](https://github.com/RiktaD/value-path/actions?path=branch%3Amain+workflow%3A%22Testing+Path%22+workflow%3Acreate-release++)[![dependabot](https://camo.githubusercontent.com/3d113d471791be9f542d9c84ffae9bef120c25886700f6e6ad433b06ef5366a4/68747470733a2f2f62616467656e2e6e65742f6769746875622f646570656e6461626f742f72696b7461642f76616c75652d70617468)](https://dependabot.com)[![maintainability score](https://camo.githubusercontent.com/a8f1a1469cb725812bd54447a79317511c8986d7d4bbb953188cd8155a219720/68747470733a2f2f62616467656e2e6e65742f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f52696b7461442f76616c75652d70617468)](https://codeclimate.com/github/RiktaD/value-path)[![tech debt %](https://camo.githubusercontent.com/01b04147e92c3ee6adda55b94f57c72352a7f89c4a4fbc61b1c18f31cb966260/68747470733a2f2f62616467656e2e6e65742f636f6465636c696d6174652f746563682d646562742f52696b7461442f76616c75652d70617468)](https://codeclimate.com/github/RiktaD/value-path/issues)[![maintainability issues](https://camo.githubusercontent.com/ec16be8aa8cd357f007ae8c79c72c7248327e280c7eb6bdeae316a7e64fb355c/68747470733a2f2f62616467656e2e6e65742f636f6465636c696d6174652f6973737565732f52696b7461442f76616c75652d706174683f6c6162656c3d6d61696e7461696e6162696c697479253230697373756573)](https://codeclimate.com/github/RiktaD/value-path/issues)

Perform get-operations on a string-notated subvalue of an object or array

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

[](#installation)

`composer require rikta/value-path`

No config, no dependency-injection, nothing. Plug&amp;Play!

Usage
-----

[](#usage)

1. Create a ValuePath-instance for a path, e.g. `$path = new ValuePath('.contact.phone.0');`
2. Invoke the instance on some data, e.g. `$phone = $path($data);`

### Example

[](#example)

```
$data = [
    [
        'name' => 'John Doe',
        'contact' => [
            'phone' => [
                '+49301234567'
            ]
        ]
    ]
];

$path = new Rikta\ValuePath\ValuePath('.contact.phone.0');
$phone = $path($data);

\PHPUnit\Framework\assertEquals('+49301234567', $phone);
```

Notation
--------

[](#notation)

On top of the "usual" dot-notation for arrays this package also support objects.

The following notations are valid:

```
new Rikta\ValuePath\ValuePath('.something'); // = $value['something']
new Rikta\ValuePath\ValuePath('.0'); // = $value[0]
new Rikta\ValuePath\ValuePath('["something"]'); // = $value['something']
new Rikta\ValuePath\ValuePath('->something'); // = $value->something
new Rikta\ValuePath\ValuePath('->something("a", "b", 1)]'); // = $value->something("a", "b", 1)

// it's also possible to chain the notations to get some deeply nested data
new Rikta\ValuePath\ValuePath('.something["somethingElse"]->someOtherThing->sth("a", "b")]');

// ' and " are interchangeable
new Rikta\ValuePath\ValuePath(".something['somethingElse']->someOtherThing->sth('a', 'b', 1)]");
```

Set Data
--------

[](#set-data)

It is planned to provide the feature to set data as well, but right now, while having multiple approaches, I don't have a satisfying concept for the chaining of methods. Properties and arrays are a no-brainer, but as soon as methods come into play the whole topic gets a bit more complicated

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~0 days

Total

2

Last Release

1691d ago

### Community

Maintainers

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

---

Top Contributors

[![MadWillow](https://avatars.githubusercontent.com/u/16151453?v=4)](https://github.com/MadWillow "MadWillow (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/rikta-value-path/health.svg)

```
[![Health](https://phpackages.com/badges/rikta-value-path/health.svg)](https://phpackages.com/packages/rikta-value-path)
```

PHPackages © 2026

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