siketyan / phpiter
为PHP爱好者提供的严格类型迭代器。
dev-main
2023-01-20 10:08 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-09-20 13:54:23 UTC
README
为PHP爱好者提供的严格类型迭代器。
🏗 前提条件
- PHP 8.1+
- PHPStan 1.9+
📦 安装
composer require siketyan/phpiter
💚 示例
简单映射
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