letharion/functional-composable-php

Wrapper around php's array functions making them composable.

Installs: 57

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/letharion/functional-composable-php

dev-master 2015-07-22 13:39 UTC

This package is not auto-updated.

Last update: 2025-10-25 21:34:36 UTC


README

Composable functional programming in PHP

Master branch status:

This library acts as a wrapper around several of PHP's built in array operators to provide an easy way to compose them.

Example:

<?php

require_once 'vendor/autoload.php';

use Letharion\Functional\Functional as F;

$a = [1, 2, 3, 4];

$f = new F($a);
$result = $f->walk(function(&$i) { return $i *= 2; })
  ->reduce(function($i, $j) { return $i + $j; })
  ->result();

var_dump($result);

int(20)