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 install
composer run tests
Functional\flatten()
Functional\unique()
, Functional\invoke_first()
,
Functional\invoke_last()
and all the discussions