rezouce/selector

Get the values from an array or a json string using fluent selectors

Installs: 1 502

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/rezouce/selector

1.0.1 2015-11-16 17:54 UTC

This package is not auto-updated.

Last update: 2025-09-27 23:26:34 UTC


README

This library allow to retrieve data from an array or a json string using selectors:

Installation

composer require rezouce/selector

Usage

<?php
use Selector\Selector;
use Selector\Parser\ArrayParser;

$data = [
    'users' => [
        'name' => 'Steve',
        'age' => 49,
    ],
    [
        'name' => 'Edward',
        'age' => 34,
    ],
];

$selector = new Selector($data, new ArrayParser);

$selector->get('users.name'); // return ['Steve', 'Edward']
$selector->get('users[1].name'); // return 'Edward'

License

This library is open-sourced software licensed under the MIT license