siketyan/phpiter

Strictly typed iterator for Rust lovers in PHP.

dev-main 2023-01-20 10:08 UTC

This package is auto-updated.

Last update: 2024-04-20 12:49:39 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