PHPackages                             m4rw3r/auto-curry - 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. m4rw3r/auto-curry

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

m4rw3r/auto-curry
=================

Provides automatic currying of functions and methods.

971PHP

Since Nov 18Pushed 12y ago3 watchersCompare

[ Source](https://github.com/m4rw3r/autoCurry)[ Packagist](https://packagist.org/packages/m4rw3r/auto-curry)[ RSS](/packages/m4rw3r-auto-curry/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

autoCurry
=========

[](#autocurry)

[![Build Status](https://camo.githubusercontent.com/d53794f17795870c48b20001359d215e812bb91577a340d53eeb191211e7a462/68747470733a2f2f7472617669732d63692e6f72672f6d34727733722f6175746f43757272792e706e67)](https://travis-ci.org/m4rw3r/autoCurry)

Enables automatic currying of functions. Every call to an `autoCurry`ed function will return a new function accepting the remaining function parameters until all parameters have been gathered whereupon the wrapped function will be executed and return its value.

Note that the function not only works on other functions, it also works on objects implementing `__invoke()`, closures, static methods and standard object methods.

To see how `autoCurry` can help you write very terse code, watch this video: [Hey underscore, you're doing it wrong!](https://www.youtube.com/watch?v=m3svKOdZijA)

Usage
-----

[](#usage)

```
$add = m4rw3r\autoCurry(function($a, $b) {
	return $a + $b;
});

$add5 = $add(5);

var_dump($add5(3)); /* int(8) */

$concat = m4rw3r\autoCurry(function($a, $b) {
	return $a . $b;
});

$namePrefix = $concat('Test');

$names = array_map($namePrefix, ['Foo', 'Bar']);
/* array(2) { [0] => string(7) "TestFoo" [1] => string(7) "TestBar" } */
```

Prototype
---------

[](#prototype)

```
callable m4rw3r\autoCurry(callable [, num_params = false])
```

- `callable`: The function/closure/method/object to curry
- `num_params`: Sets the limit for the auto-curry, useful in cases where optional parameters are present or when a method accepting any number of parameters is being curryed.

`autoCurry()` will automatically determine the number of parameters if `num_params` is `false`, through the use of `ReflectionMethod` and `ReflectionFunction`.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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/108100?v=4)[Martin Wernstål](/maintainers/m4rw3r)[@m4rw3r](https://github.com/m4rw3r)

---

Top Contributors

[![m4rw3r](https://avatars.githubusercontent.com/u/108100?v=4)](https://github.com/m4rw3r "m4rw3r (21 commits)")

### Embed Badge

![Health badge](/badges/m4rw3r-auto-curry/health.svg)

```
[![Health](https://phpackages.com/badges/m4rw3r-auto-curry/health.svg)](https://phpackages.com/packages/m4rw3r-auto-curry)
```

###  Alternatives

[dcat-admin/operation-log

Dcat Admin 操作日志扩展

4413.9k](/packages/dcat-admin-operation-log)[protocolbuffers/protoc-gen-php

protoc generator plugin for PECL ProtocolBuffers

529.1k](/packages/protocolbuffers-protoc-gen-php)

PHPackages © 2026

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