grifix / array-wrapper
This package is abandoned and no longer maintained.
No replacement package was suggested.
Grifix Array Wrapper
3.0.0
2023-05-15 14:29 UTC
Requires
- php: ^8.1
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Usage:
$wrapped = \Grifix\ArrayWrapper\ArrayWrapper::create([
'name' => 'Joe',
'address' => [
'city' => 'London'
],
'tasks' => [
'wash car',
'buy food'
]
])
$wrapped->getElement('address');// returns ['city' => 'London']
$wrapped->getElement('address.city'); // 'London'
$wrapped->getElement('tasks.1'); //buy food
$wrapped->hasElement('tasks.1'); //true
$wrapped->hasElement('tasks.3'); //false
$wrapped->isAssociative(); //true
$wrapped->setElement('address.country', 'Uk');
$wrapped->addElement('tasks', 'clean the apartment');
$wrapped->getFirstElement(); //returns "Joe"
$wrapped->getLastElement(); //returns tasks array
$wrapped->removeElement('address.city');