lambdish/phunctional
lambdish/phunctional is a functional programming toolkit for PHP and Laravel. It offers immutable collections, Option and Either types, currying, function composition, memoization, and pipeline helpers, making it easier to write expressive, side-effect-aware code without leaving familiar PHP.
curry, compose, pipe, map/filter/reduce helpers, this package sets one small, MIT-licensed baseline. The decision it forces is: do we own this code, or depend on it? (Here, the honest answer may be "vendor a copy and own it.")Consider it when:
array_map / array_filter and wants composition and currying in plain PHP without adopting a full FP framework.Look elsewhere when:
azjezz/psl, loophp/collection, functional-php, or plain illuminate/support first.For executives: This is a small, MIT-licensed helper library that makes PHP data-transformation code shorter and easier to test, with essentially no licensing cost and minimal lock-in. The tradeoff is maturity: it has not had a release since 2020 and is a low-profile open-source project. My recommendation is therefore a time-boxed pilot in a single service, not a platform-wide standard. We cap our exposure, prove the readability and performance benefit, and if it earns its place we vendor a copy and own it ourselves. Cost is measured in engineering hours, not license fees, and the downside is bounded.
For engineering: It gives us curry, compose, pipe, and lightweight map/filter/reduce semantics in pure PHP, focused on simplicity and speed. It complements Laravel rather than replacing Collections — we would use it where the fluent collection layer is more machinery than we need, particularly in transformation pipelines and export/reporting code. Two things need to be true before we commit: (1) a half-day of compatibility verification against our target PHP version, with a PHPStan/Psalm baseline, and (2) a short internal style note on when point-free code is appropriate so reviewers and new hires are not decoding nested closures. The codebase is small enough to fork if the upstream project stays dormant — that is a contingency we should plan for, not be surprised by.
How can I help you explore Laravel packages today?