An open API service indexing awesome lists of open source software.

https://github.com/jeydotc/jeydotc-enumerable

An enumerable class that mimics the concepts of .Net's IEnumerable interface, but with slight adaptations for PHP.
https://github.com/jeydotc/jeydotc-enumerable

collection collections ienumerable immutable

Last synced: 3 months ago
JSON representation

An enumerable class that mimics the concepts of .Net's IEnumerable interface, but with slight adaptations for PHP.

Awesome Lists containing this project

README

        

# Enumerable class!

```php
$myEnumerable = Enumerable::from([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);

$even = $myEnumerable->where(function(int $number){
return $number % 2 === 0;
});
// new Enumerable: 2, 4, 6, 8, 10

$allPowered = $myEnumerable->select(function(int $number){
return $number * $number;
});
// new Enumerable: 1, 4, 9, 16, 25, 36, 48, 64, 81, 100

$theAlpha = $myEnumerable->first();
// 1

$theOmega = $myEnumerable->last();
// 10

// And many more...
```

## Installation

```bash
composer install jeydotc/jeydotc-enumerable
```