extphp/data-dot

A property accessor helper capable of using dot notation for a mix of arrays and objects.

Installs: 1 654

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/extphp/data-dot

v0.1 2018-11-13 17:26 UTC

This package is auto-updated.

Last update: 2025-10-14 10:35:36 UTC


README

Build Status Latest Stable Version License Total Downloads

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