bcismariu / commons-descendable
A property accessor helper capable of using dot notation for a mix of arrays and objects
Installs: 116
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bcismariu/commons-descendable
Requires (Dev)
- phpunit/phpunit: ^6.2
This package is auto-updated.
Last update: 2026-02-13 09:17:01 UTC
README
A generic dot notation accessor, able to handle a mix of arrays and objects
Installation
composer require bcismariu/commons-descendable:^0.1
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