picios / dottedarray
Get and set array node using dot notation
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/picios/dottedarray
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2025-12-07 02:36:21 UTC
README
Gets and sets an array node using a dot notation. It gives a convenient access to an array elements. Particularly recommended for config arrays.
Usage
use Picios\DottedArray\DottedArray; require_once __DIR__ . '/vendor/autoload.php'; $array = array( 'women' => array( 'cloths' => 'always lack', 'money' => 'never enough', 'mind' => 'calm', ), 'men' => array( 'cloths' => 'whatever', 'money' => 'hidden', 'mind' => 'reckless', ), ); $dottedArray = new DottedArray($array); echo $dottedArray->get('women.cloths'); $dottedArray->set('women.cloths', 'ok'); echo $dottedArray->get('women.cloths');
Also can be used with globals, like $_SESSION
$session = new \Picios\DottedArray\DottedArray($_SESSION); echo $session->get('user.name');
Testing
sudo phpunit test --bootstrap vendor/autoload.php
Homepage
You can read more at Picios.pl