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.
|>) syntax improves readability for complex transformations (e.g., chaining filter → map → join).foreach loops or manual string manipulation with optimized functions.fn (Post $post) => ...).Adopt if:
foreach/str_replace chains.Look elsewhere if:
php-functional or underscore.php for more advanced FP features (e.g., currying, monads)."Piper is a low-risk, high-reward tool to standardize and accelerate data processing in our PHP codebase. By adopting this package, we can:
userData |> filterActive() |> mapToExportFormat())."Piper brings Laravel’s utility methods to standalone PHP, giving us:
|>) syntax for elegant, composable data flows (e.g., chaining filter/map/join).kebab(), password(), deduplicate())—no more copying Laravel’s Str:: or Arr:: helpers.fn (User $user) => ...).requestData |> trim() |> validate()).
Example:$exportData = $users
|> filter(fn (User $u) => $u->isActive())
|> map(fn (User $u) => $u->name)
|> join(', ');
Pros: Faster development, fewer bugs, easier maintenance. Cons: Minimal learning curve (just |> syntax)."*
How can I help you explore Laravel packages today?