ronappleton/php-dot

Set and get array values via dot notation.

v1.0 2020-02-24 21:53 UTC

This package is auto-updated.

Last update: 2024-04-25 07:25:58 UTC


README

Php Dot allows you to add and retreive values from a php array via dot notation.

Installation

composer require ronappleton/php-dot "v1.0"

Usage

Declare use RonAppleton\Dot\Dot; at the top of your file.

Then:

$dot = new Dot;

$value = $dot->get($array, 'key.to.your.value', $defaultValue);

$success = $dot->set($array, 'key.to.append.value', $value);

Note: set accesses the array via reference and returns true on success.