rezouce / selector
Get the values from an array or a json string using fluent selectors
1.0.1
2015-11-16 17:54 UTC
Requires (Dev)
- phpspec/phpspec: ~2.1
This package is not auto-updated.
Last update: 2026-03-29 02:17:18 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