PHPackages                             lupsor/array-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. lupsor/array-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

lupsor/array-parser
===================

This package get data from an associative array

v0.9.0(4y ago)09.7k↓28.6%MITPHPPHP ^7.4|^8

Since May 16Pushed 3y agoCompare

[ Source](https://github.com/Lupsor/array-parser)[ Packagist](https://packagist.org/packages/lupsor/array-parser)[ RSS](/packages/lupsor-array-parser/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Lupsor Array Parser
===================

[](#lupsor-array-parser)

[![Total Downloads](https://camo.githubusercontent.com/ae5236f19b27a18fcae56e89d8e1b346215e4b6f9e44c95a1eb43464fc942b4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c7570736f722f61727261792d706172736572)](https://packagist.org/packages/lupsor/array-parser)[![Latest Stable Version](https://camo.githubusercontent.com/c446621b893f032a414cc7b8228150b04d058ae6e5209389cf7d2f6f41d236b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c7570736f722f61727261792d706172736572)](https://packagist.org/packages/lupsor/array-parser)[![License](https://camo.githubusercontent.com/c4daa1d8c217721a5a21ac5dbce0fcd31d81835c6596ddd35b477c8ba9d95025/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c7570736f722f61727261792d706172736572)](https://packagist.org/packages/lupsor/array-parser)

About package
-------------

[](#about-package)

This package get data from an associative array.

Knowing the path to the data you need in the array, you can easily get it using `ArrayParser`, without having to iterate through the array yourself.

Содержание
----------

[](#содержание)

1. [Setup](#setup)
2. [Using](#using)
    1. [ParserString](#parserString)
        1. [Without collection](#withoutCollection)
        2. [With collection](#withCollection)
    2. [Parse object](#parseObject)
    3. [Examples of using](#examples)
3. [Additionally](#additionally)
    1. [Unique values](#unique)

Setup
--------------------------------------

[](#setup)

To install the package, run on the command line:

```
composer install lupsor/array-parser

```

Using
--------------------------------------

[](#using)

To get the desired value, run: `ArrayParser::parse($data, $parserString)`, where `$date` is an array from which you want to get the value, and `$parserString` is a link to the received data

### ParserString

[](#parserstring)

#### Without collection

[](#without-collection)

Before you get the necessary data, you need to form a link to the data you need. Example:

`three->one->one`, where `three`, `one` and `one` - are the array key, and `->` is the separator.

Based on this example, the `ArrayParser` will refer to the array element with the key `three`, there it will refer to the element with the key `one` and it will get the value of the element with the key `one`.

#### With collection

[](#with-collection)

You can also get data from the collection by wrapping the required value in square brackets (`[`, `]`). Example:

`three->[one]`, where `[one]` - collection. The parser will iterate over all the values in the element with the key "three" and from each element of the array will get the value with the key "one".

The collection can be more complex, like `[one->two]`. You can learn more about this structure in example No. 2 and 3.

### Parse object

[](#parse-object)

The first argument `ArrayParser::parse` (`$data`) can be sent as an object, in which case the path must only point to functions that require no arguments.

### Examples of using

[](#examples-of-using)

#### Example 1 (without collection)

[](#example-1-without-collection)

```
use Lupsor\ArrayParser\ArrayParser;

$data = [
    'one' => 'oneValue',
    'three' => [
        'one' => ['one' => 'threeOneOneValue',],
    ],
];
$parserString = 'three->one->one';

ArrayParser::parse($data, $parserString);
```

The result of running this example will be: `threeOneOneValue`

#### Example 2 (with collection)

[](#example-2-with-collection)

```
use Lupsor\ArrayParser\ArrayParser;

$data = [
    'four' => [
        ['one' => 'fourOneValue',],
        ['one' => 'fourTwoValue',],
    ],
];
$parserString = 'four->[one]';

ArrayParser::parse($data, $parserString);
```

Result: `fourOneValue, fourTwoValue`

#### Example 3 (with collection)

[](#example-3-with-collection)

```
use Lupsor\ArrayParser\ArrayParser;

$data = [
    'five' => [
        [
            'one' => [
                ['one' => 'fiveOneOneValue',],
                ['one' => 'fourOneTwoValue',],
            ],
        ],
        [
            'one' => [
                ['one' => 'fiveTwoOneValue',],
                ['one' => 'fourTwoTwoValue',],
                ['one' => 'fourTwoThreeValue',],
            ],
        ],
    ],
];
$parserString = 'five->[one->[one]]';

ArrayParser::parse($data, $parserString);
```

Result: `fiveOneOneValue, fourOneTwoValue, fiveTwoOneValue, fourTwoTwoValue, fourTwoThreeValue`

Additionally
----------------------------------------------------

[](#additionally)

### Unique values

[](#unique-values)

You can return only unique values by adding `:unique` at the end of `ParserString`. Example: `five->[one->[one]]:unique`

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

1509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26df49df21d72be8277ddd244c52b350e4dd030a0dfa4fbd94c992df8064c18a?d=identicon)[Unzerstorbar](/maintainers/Unzerstorbar)

---

Top Contributors

[![MadeFrost](https://avatars.githubusercontent.com/u/33905785?v=4)](https://github.com/MadeFrost "MadeFrost (7 commits)")

### Embed Badge

![Health badge](/badges/lupsor-array-parser/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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