extphp / data-dot
A property accessor helper capable of using dot notation for a mix of arrays and objects.
v0.1
2018-11-13 17:26 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^5.0|^6.0|^7.0
This package is auto-updated.
Last update: 2026-03-14 11:38:27 UTC
README
A simple dot notation accessor, able to handle a mix of arrays and objects.
Usage
<?php use ExtPHP\DataDot\Dot; $data = [ 'eyes' => 'blue', 'age' => '27', 'parents' => [ 'mother' => 'Jane', 'father' => 'Jack' ] ]; $dot = new Dot($data); $dot->get('parents.father', 'John'); // returns 'Jack' $dot->get('sister', 'Kate'); // returns 'Kate'
Testing
php vendor/bin/phpunit