PHPackages                             phrenotype/lambda - 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. phrenotype/lambda

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

phrenotype/lambda
=================

Converts php functions to lambdas

v1.5.0(3y ago)18MITPHPPHP &gt;=7.0.0

Since Jan 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/phrenotype/lambda)[ Packagist](https://packagist.org/packages/phrenotype/lambda)[ RSS](/packages/phrenotype-lambda/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Lambda
======

[](#lambda)

[![github stars](https://camo.githubusercontent.com/eb57e41e2e63189ba37c632c94e364c33cdabaa087a0acac30713d1c9708b770/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f706872656e6f747970652f6c616d6264613f7374796c653d736f6369616c)](https://camo.githubusercontent.com/eb57e41e2e63189ba37c632c94e364c33cdabaa087a0acac30713d1c9708b770/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f706872656e6f747970652f6c616d6264613f7374796c653d736f6369616c)[![license](https://camo.githubusercontent.com/2038d10b07b828d274cbdfd24d8128b565b22300ce7c9ffb19a7ed212b8e63c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706872656e6f747970652f6c616d626461)](https://camo.githubusercontent.com/2038d10b07b828d274cbdfd24d8128b565b22300ce7c9ffb19a7ed212b8e63c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706872656e6f747970652f6c616d626461)[![contributors](https://camo.githubusercontent.com/ceeb173309ba7924fa4f7e27869253abb98fa8f5c83c8c11d2ad7849fd239dca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f706872656e6f747970652f6c616d626461)](https://camo.githubusercontent.com/ceeb173309ba7924fa4f7e27869253abb98fa8f5c83c8c11d2ad7849fd239dca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f706872656e6f747970652f6c616d626461)[![code size](https://camo.githubusercontent.com/b0c68e04181f0e642c516a7a1de1b2e0bf4bcfeecfa6dea1ad4c2121620501ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f706872656e6f747970652f6c616d626461)](https://camo.githubusercontent.com/b0c68e04181f0e642c516a7a1de1b2e0bf4bcfeecfa6dea1ad4c2121620501ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f706872656e6f747970652f6c616d626461)

This is a library for converting both named and annonymous php functions into lambda expressions. This the allows them to be curried and partially applied.

Install
-------

[](#install)

`composer require phrenotype/lambda`

Examples
--------

[](#examples)

#### With all parameters required

[](#with-all-parameters-required)

```
$add = lambda(function($a, $b, $c){
	return $a + $b + $c;
});

echo $add(4,5,2);
echo $add(4,5)(2);
echo $add(4)(5,2);
echo $add(4)(5)(2);
```

#### With optional parameters

[](#with-optional-parameters)

This is a little bit tricky.

```
$add = lambda(function($a, $b, $c=2){
	return $a + $b + $c;
});
```

The key thing to remember is that once the numbers of arguments applied ***exactly matches*** the required number of arguments, It will return a result, not a lambda. So, in applying arguments, do not apply them curry style when dealing with optional parameters. Use partial application instead.

```
echo $add(4,5,2); // Ok
echo $add(4)(5,2) // Ok
echo $add(4,5)(2); // Error
echo $add(4)(5)(2); //Error
```

Contact
-------

[](#contact)

**Email** :

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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.

###  Release Activity

Cadence

Every ~439 days

Total

2

Last Release

1158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/adf1dd383d12e22f502f37f13566c2b569e4c8aecf151af7e34a3ce74b0d86b5?d=identicon)[paulrobert](/maintainers/paulrobert)

---

Tags

currycurryingfunction-applicationfunctional-programminglambdalambda-functionspartial-applicationphplambdacurrycurrying

### Embed Badge

![Health badge](/badges/phrenotype-lambda/health.svg)

```
[![Health](https://phpackages.com/badges/phrenotype-lambda/health.svg)](https://phpackages.com/packages/phrenotype-lambda)
```

###  Alternatives

[lambdish/phunctional

λ PHP functional library

3612.0M23](/packages/lambdish-phunctional)[akamon/phunctional

λ PHP functional library

3609.4k](/packages/akamon-phunctional)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)[krak/fn

Functional library for php with proper currying

2419.0k3](/packages/krak-fn)

PHPackages © 2026

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