PHPackages                             jean-carlo-machado/f - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jean-carlo-machado/f

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jean-carlo-machado/f
====================

10203PHP

Since Oct 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jeanCarloMachado/f)[ Packagist](https://packagist.org/packages/jean-carlo-machado/f)[ RSS](/packages/jean-carlo-machado-f/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

f
=

[](#f)

f is a functional lib for php

**Note: this lib is not optimized for performance yet**

Currying
--------

[](#currying)

```
$threeArgs = function($a, $b, $c) {
    return [$a, $b, $c];$expected =
};
$treeArgsPartial  = \f\partial($threeArgs);
$firstAs666 = $treeArgsPartial(666);
$firstAs666(777, 888);
//[666,777,888]
```

Fold
----

[](#fold)

```
$addOne = function($a, $b) {
    return $a+1;
};
$count = \f\fold($addOne, 0);
$count([3, 4, 5, 7]);
//4
```

Fold Tree
---------

[](#fold-tree)

```
$tree = [
    '01' => [
        '02',
        '03' => [
            '4',
        ],
    ]
];
\f\foldTree($sum, $sum, 0, $tree)
//10
```

Map Tree
--------

[](#map-tree)

```
$tree = [
    '03' => [1,4],
    '01' => [1,'05' => [1,2, 3]]
];
$double = function($a) {
    return $a*2;
};
$result  = \f\mapTree($double, $tree);
//[
//    '06' => [2,8],
//    '02' => [2,'010' => [2,4,6]]
//];
```

Pattern matching
----------------

[](#pattern-matching)

```
$sumList = \f\patternMatch([
    '[]' => 0,
    '(x:xs)' => function ($x, $xs) use (&$sumList) {
        return $x + $sumList($xs);
    }
]);

$sumList([1,2,3]);
//6
```

Lazy loading
------------

[](#lazy-loading)

```
\f\takeFrom(\f\infinity(), 5)
//[0,1,2,3,4]
```

Memoize
-------

[](#memoize)

```
$calls = 0;
$factorial = function($x) use (&$factorial, &$calls) {
    $calls++;
    if ($x == 1) {
        return 1;
    }
    return $x * $factorial($x - 1);
};

$memoizedFactorial = \f\memoize($factorial);
$memoizedFactorial(4);
$memoizedFactorial(4);
//$calls = 4
```

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2252355?v=4)[Jean Carlo Machado](/maintainers/JeanCarloMachado)[@jeanCarloMachado](https://github.com/jeanCarloMachado)

---

Top Contributors

[![sergiors](https://avatars.githubusercontent.com/u/2046276?v=4)](https://github.com/sergiors "sergiors (3 commits)")[![lucassabreu](https://avatars.githubusercontent.com/u/3457213?v=4)](https://github.com/lucassabreu "lucassabreu (1 commits)")

### Embed Badge

![Health badge](/badges/jean-carlo-machado-f/health.svg)

```
[![Health](https://phpackages.com/badges/jean-carlo-machado-f/health.svg)](https://phpackages.com/packages/jean-carlo-machado-f)
```

###  Alternatives

[wikimedia/less.php

PHP port of the LESS processor

12330.5M150](/packages/wikimedia-lessphp)[nextras/datagrid

Datagrid component for Nette Framework.

75272.6k4](/packages/nextras-datagrid)[dachcom-digital/seo

Pimcore SEO Enrichment Bundle

36236.5k3](/packages/dachcom-digital-seo)[starfederation/datastar-php

A PHP SDK for working with Datastar.

4238.4k25](/packages/starfederation-datastar-php)[angle/chrono

The easiest way to measure PHP code execution time.

2817.5k](/packages/angle-chrono)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
