library commons-descendable
A property accessor helper capable of using dot notation for a mix of arrays and objects
bcismariu/commons-descendable
A property accessor helper capable of using dot notation for a mix of arrays and objects
- Friday, July 21, 2017
- by bcismariu
- Repository
- 1 Watchers
- 0 Stars
- 73 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Dot notation descendable
, (*1)
A generic dot notation accessor, able to handle a mix of arrays and objects, (*2)
Installation
composer require bcismariu/commons-descendable:^0.1
, (*3)
Usage
<?php
use Bcismariu\Commons\Descendable\Descendable;
$array = [
'eyes' => 'blue',
'age' => '27',
'parents' => [
'mother' => 'Jane',
'father' => 'Jack'
]
];
$descendable = new Descendable($array);
$descendable->get('parents.father', 'John'); // returns 'Jack'
$descendable->get('sister', 'Kate'); // returns 'Kate'
Testing
php vendor/bin/phpunit
dev-master
9999999-dev
A property accessor helper capable of using dot notation for a mix of arrays and objects
Sources
Download
The Development Requires
by
Bogdan Cismariu
v0.1
0.1.0.0
A property accessor helper capable of using dot notation for a mix of arrays and objects
Sources
Download
The Development Requires
by
Bogdan Cismariu