A familiar and powerful Data Object abstraction for PHP.
Create an objects list from array:
use \IvoPetkov\DataList;
$data = [
['value' => 'a'],
['value' => 'b'],
['value' => 'c']
];
$list = new DataList($data);
// Can access the objects by index and get properties the following ways
echo $list[0]->value; // Output: a
echo $list[1]->value; // Output: b
// Can loop through the objects
foreach($list as $object){
echo $object->value;
}
And here are same helpful methods to modify the list:
use \IvoPetkov\DataList;
$list = new DataList([...]);
$list
->filterBy('property1', '...')
->sortBy('property2')
->map(function($object){});
composer require ivopetkov/data-object
Full documentation is available as part of this repository.
This project is licensed under the MIT License. See the license file for more information.
Feel free to open new issues and contribute to the project. Let's make it awesome and let's do in a positive way.
This library is created and maintained by Ivo Petkov (ivopetkov.com) and some awesome folks.