[go: up one dir, main page]

Skip to content

A familiar and powerful Data Object abstraction for PHP.

License

Notifications You must be signed in to change notification settings

ivopetkov/data-object

Repository files navigation

Data Object

A familiar and powerful Data Object abstraction for PHP.

Latest Stable Version License

Usage

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){});

Install via Composer

composer require ivopetkov/data-object

Documentation

Full documentation is available as part of this repository.

License

This project is licensed under the MIT License. See the license file for more information.

Contributing

Feel free to open new issues and contribute to the project. Let's make it awesome and let's do in a positive way.

Authors

This library is created and maintained by Ivo Petkov (ivopetkov.com) and some awesome folks.