Skip to content

Wrappers for iterable data

Notifications You must be signed in to change notification settings

Tolkam-PHP-Components/collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tolkam/collection

Wrappers for iterable data.

Documentation

The code is rather self-explanatory and API is intended to be as simple as possible. Please, read the sources/Docblock if you have any questions. See Usage for quick start.

Usage

use Tolkam\Collection\LazyCollection;

$collection = LazyCollection::create(function() {
    // do some database query or something heavy
    echo 'fetched!' . PHP_EOL;
    yield from range(0, 9);
}, true);

// manipulate collection before data if fetched
$collection = $collection
    ->reverse()
    ->keyBy(fn($item) => 'key' . $item);

// get the manipulation result
print_r($collection->toArray());

License

Proprietary / Unlicensed 🤷

About

Wrappers for iterable data

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages