siketyan / phpiter
Strictly typed iterator for Rust lovers in PHP.
dev-main
2024-11-06 17:01 UTC
Requires
- php: ^8.1
Requires (Dev)
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- yumemi-inc/php-cs-fixer-config: ^8.1
This package is auto-updated.
Last update: 2024-11-06 17:02:43 UTC
README
Strictly typed iterator for Rust lovers in PHP.
🏗 Prerequisites
- PHP 8.1+
- PHPStan 1.9+
📦 Installation
composer require siketyan/phpiter
💚 Examples
Simple mapping
use Siketyan\PhpIter\Iter; Iter::of([1, 2, 3, 4, 5]) ->map(fn ($value) => $value * 10) ->toArray(); // -> [10, 20, 30, 40, 50]
✅ TODO
- all
- any
- chain
- cloned
- collect
- count
- cycle
- enumerate
- eq
- filter
- filter_map
- find
- find_map
- flat_map
- flatten
- fold
- for_each
- fuse
- inspect
- last
- nth
- partition
- peekable
- position
- product
- reduce
- rev
- rposition
- scan
- size_hint
- skip
- skip_while
- step_by
- sum
- take
- take_while
- try_fold
- try_for_each
- unzip
- zip