mduk / dot
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mduk/dot
Requires (Dev)
- phpunit/phpunit: ~4.7
This package is not auto-updated.
Last update: 2026-02-04 15:43:47 UTC
README
Just a little something to make working with config arrays easier.
Example
$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!' ]