Ease of use collection class. 100% Code Coverage in Tests.
The Library is PSR-1, PSR-4, PSR-12 compliant.
>= PHP 7.2
none
composer require typomedia/collection
use Typomedia\Collection\Collection;
$data = [
'Moretti' => [
'name' => 'Style Ale',
'style' => 'European Amber Lager',
'alcohol' => '9.1%'
]
];
$collection = new Collection();
$key = md5(serialize($data));
$collection->set((object)$data, $key);
$collection->get($key);
$collection->first();
$collection->last();
$collection->keys();
$collection->find('name', 'Style Ale');
$collection->delete($key);