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.
NOTE: functional-php used to come with a C extension that implemented most of the functions natively. As the performance differences weren’t that huge compared to the maintenance cost it has been removed.
A set of functional primitives for PHP, heavily inspired by Scala’s traversable collection, Dojo’s array functions and Underscore.js
Traversable$value, $index, $collection. Strict comparison is the default but can be changedFunctional to not raise conflicts with any other extension or libraryRun the following command in your project root:
composer require lstrojny/functional-php
git clone the projectcomposer installcomposer run testsFunctional\flatten()Functional\unique(), Functional\invoke_first(),
Functional\invoke_last() and all the discussionsHow can I help you explore Laravel packages today?