spatie/piper
Pipe-operator-first PHP utility library for array and string manipulation. Piper ports many Laravel Collection and Str helpers to standalone functions that work with primitives, so you can compose readable pipelines for filtering, mapping, joining, and more.
Piper requires PHP 8.5 or higher, which introduced the pipe operator (|>).
You can install Piper via Composer.
composer require spatie/piper
That's it. Piper exposes its functions in the Spatie\Piper\Arr and Spatie\Piper\Str namespaces. You can import any function and use it with the pipe operator.
use function Spatie\Piper\Arr\{filter, map};
[1, 2, 3]
|> filter(fn (int $i) => $i > 1)
|> map(fn (int $i) => $i * 2);
How can I help you explore Laravel packages today?