colindev/php-object-chain

v0.0.2 2015-07-13 03:09 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:32:43 UTC


README

php 物件/陣列 索引鍊

install

設定依賴套件,並更新

    composer require colin/object-chain
    composer update

test

執行單元測試

    
    phpunit

sample

use Colin\ObjectChain;

$data = new ObjectChain(json_decode('{"key":"hello","vary":{"depth":{"key":"found"}}}'));

$data->{'key'}->value();// return 'hello'
$data['key']->value();// return 'hello'

$data['vary']['depth']['key']->value();// return 'found'
$data['vary']['depth']['depth']['key']->value();// return null