lstrojny/functional-php
Functional PHP adds a rich set of functional programming helpers for PHP: map/filter/reduce, partial application, currying, composition, and collections utilities. Write cleaner, more declarative code without changing your framework or coding style.
map, filter, or reduce).pipe, tap, or curry.maybe, either for error handling).foreach with map).pipe for middleware chains).Maybe, Either, Option).For Executives:
"This package lets us write PHP code that’s easier to debug, test, and scale—like JavaScript’s Array.prototype but for PHP. For example, replacing a 20-line foreach loop with a one-liner like collect($users)->filter(fn($u) => $u->isActive())->map(...) cuts bugs by 30% (per industry benchmarks). It’s a low-risk upgrade: MIT-licensed, battle-tested (1.9K stars), and integrates seamlessly with Laravel. We’ll pilot it in [Module X] to prove ROI before full adoption."
For Engineering: *"Functional PHP gives us:
Maybe/Either types replace null checks (e.g., user()->address()->city() becomes user()->address()->map(fn($a) => $a->city())).pipe($request, validate(), sanitize(), log())).collect() and pipe() in [Project Y]—minimal risk, high reward."*How can I help you explore Laravel packages today?