Functional primitives for PHP

Installs: 89 236

Dependents: 13

Stars: 482

Watchers: 38

Forks: 63

Open Issues: 3

Language: PHP

1.0.0 2015-06-23 21:56 UTC


Gitter Build Status Dependency Status Average time to resolve an issue Percentage of issues still open Scrutinizer Code Quality

A set of functional primitives for PHP, heavily inspired by Scala’s traversable collection, Dojo’s array functions and Underscore.js

  • Works with arrays and everything implementing interface Traversable
  • Consistent interface: for functions taking collections and callbacks, first parameter is always the collection, than the callback. Callbacks are always passed $value, $index, $collection. Strict comparison is the default but can be changed
  • Calls 5.3 closures as well as usual callbacks
  • All functions reside in namespace Functional to not raise conflicts with any other extension or library

Functional Comic


Using composer

Put the require statement for functional-php in your composer.json file and run php composer.phar install:

    "require": {
        "lstrojny/functional-php": "~1.2"


Checkout functional-php and include the _import.php

include 'path/to/functional-php/src/Functional/_import.php';


Read the docs

Running the test suite

To run the test suite use vendor/bin/phpunit tests/

Mailing lists

Thank you