Skip to content

Xenira/php-iter-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Iter Tools

Table of Contents

Simple PHP library for making working with iterators more fun.

Heavily inspired by rust’s iterators.

Currently not all methods are implemented, but the most important ones are. Use with caution.

1. Usage

$iterator = new ArrayIterator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
$iterator = $iterator
    ->filter(fn ($value) => $value % 2 === 0)
    ->map(fn ($value) => $value * 2)
    ->take(4);

assert($iterator->collect() === [4, 8, 12, 16]);

About

Make php iterators usable

Resources

License

Stars

Watchers

Forks

Packages

No packages published