Welcome to PSI - Php Simplified Iterations’s documentation!¶
PSI aims at helping you to write better and more stable PHP-Code. Especially when it comes to iterating, filter, sorting.
Introduction¶
Let’s start with an example.
$input = $service->getStuff();
$result = Psi::it($input)
->filter(new IsInstanceOf(Person::class))
->filter(function (Person $p) { return $p->getAge() >= 18; })
->collect();
The example above will filter the input and will only keep instances of Person that have an age of at least 18 years.