mduk / dot
此包的最新版本(1.0.0)没有提供许可证信息。
1.0.0
2015-07-27 23:46 UTC
Requires (Dev)
- phpunit/phpunit: ~4.7
This package is not auto-updated.
Last update: 2024-10-02 09:34:18 UTC
README
这只是一个让处理配置数组更简单的工具。
示例
$config = [
'a' => [
'b' => [
'c' => [
'd' => 'e!'
]
]
]
];
$dot = new Mduk\Dot( $config );
// Fetch a particular key
$dot->get( 'a.b.c.d' ); // 'e!'
// Set a key with dot notation
$dot->set( 'a.b.c.e', 'f!' );
// Fetch a key further up to get lower keys as a deep array
$dot->get( 'a.b.c' ); // [ 'd' => 'e!', 'e' => 'f!' ]
// Creating child keys of a key will overwrite any previously set value
$dot->set( 'a.b.c.d.e', 'g?' );
$dot->get( 'a.b.c' ); // [ 'd' => [ 'e' => 'g?' ], 'e' => 'f!' ]