mduk/dot

There is no license information available for the latest version (1.0.0) of this package.

Maintainers

Details

github.com/mduk/dot

Source

Issues

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/mduk/dot

1.0.0 2015-07-27 23:46 UTC

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!' ]