https://github.com/elephox-dev/pie
PHP Iterables Enhanced. C# enumerables in PHP. Part of the Elephox framework. [READONLY]
https://github.com/elephox-dev/pie
Last synced: 3 months ago
JSON representation
PHP Iterables Enhanced. C# enumerables in PHP. Part of the Elephox framework. [READONLY]
- Host: GitHub
- URL: https://github.com/elephox-dev/pie
- Owner: elephox-dev
- Archived: true
- Created: 2021-12-27T18:56:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-11T00:10:08.000Z (about 4 years ago)
- Last Synced: 2024-05-28T14:08:17.044Z (almost 2 years ago)
- Language: PHP
- Homepage: https://elephox.dev
- Size: 123 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PIE - PHP Iterables Enhanced
===
This library (or rather module) was inspired by [C#s LINQ library](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/).
However, it is not a full-featured LINQ library. It is only a small subset of the functionality since PHP cannot fully support all the syntactic sugar.
For example the main feature of LINQ, SQL-like syntax directly in source, is not supported since it would require you to compile/transpile your code.
The main idea however is to provide a way to iterate over a collection of objects in a more natural way like you can do with `IEnumerable`s in C#.
## Examples
```php
orderBy(fn (int $item) => $item)
->select(function (int $item) {
echo $item;
});
// output: 12345
$pie->where(fn (int $item) => $item % 2 === 0)
->select(function (int $item) {
echo $item;
});
// output: 24
```