colindev/php-object-chain

物件索引鍊

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/colindev/php-object-chain

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

This package is not auto-updated.

Last update: 2025-10-12 01:14:14 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