The Data class is the primary entry point. You can use it to manipulate nested structures via dot or slash notation.
Key Methods:
set(string $path, $value): Sets a value at the specified path. If the path contains intermediate keys, they are created as nested structures.get(string $path, $default = null): Retrieves the value at the path. If the path does not exist, it returns the $default value. If no default is provided and the path is missing, it throws a MissingPathException.append(string $path, $value): Appends a value to an existing array at the specified path.has(string $path): Returns true if the path exists, false otherwise.remove(string $path): Removes the data at the specified path.getData(string $path): Returns a new DataInterface instance representing the sub-structure at the given path.
use Dflydev\DotAccessData\Data;
$data = new Data;
$data->set('a.b.c', 'C');
$data->append('a.b.d', 'D1');
$data->set('a.b.e', ['E0', 'E1', 'E2']);
// Accessing values
$val = $data->get('a.b.c'); // 'C'
$exists = $data->has('a.b.c'); // true
// Using defaults for missing paths
$missing = $data->get('non.existent', 'default_value'); // 'default_value'