PHP code example of codin / dot

1. Go to this page and download the library: Download codin/dot library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codin / dot example snippets


$dot = new Codin\Dot(['foo' => ['bar' => 'baz']]);

$dot->get() // ['foo' => ['bar' => 'baz']]
$dot->get('foo') // ['bar' => 'baz']
$dot->get('foo.bar') // 'baz'
$dot->get('foo.bar.qux') // null
$dot->get('foo.bar.qux', 'hello') // 'hello'

$dot->set('foo.bar', 'qux');
$dot->get() // ['foo' => ['bar' => 'qux']]

$dot->set('foo.bar.baz', 'qux'); // throws DotException the value at the index is not an array and wont be converted.
// Instead store the value as an array to overwrite
$dot->set('foo.bar', ['baz' => 'qux']);