PHPackages                             nemorize/curried - 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. nemorize/curried

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

nemorize/curried
================

A utility to create curried functions that its parameters are reordered by user-defined order.

0.0.1(3y ago)17MITPHPPHP &gt;=8.1

Since Feb 17Pushed 3y agoCompare

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

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

php-create-curried
==================

[](#php-create-curried)

A utility to create curried functions that its parameters are reordered by user-defined order.
Inspired by .

Requirements
------------

[](#requirements)

- PHP 8.1 or later

Installation
------------

[](#installation)

```
composer require nemorize/curried
```

Usage
-----

[](#usage)

### `Curried`

[](#curried)

#### `Curried::from(Closure $fn): Context`

[](#curriedfromclosure-fn-context)

Returns a `Context` for a given closure.

```
use Nemorize\Curried\Curried;
$context = Curried::from(function ($foo, $bar) {
    return $foo . $bar;
});
```

### `Context`

[](#context)

#### `Context::takes(int $position): Context`

[](#contexttakesint-position-context)

Takes a parameter at the given position.

```
use Nemorize\Curried\Curried;
$context = Curried::from(function ($foo, $bar) {
    return $foo . $bar;
})->takes(0)->takes(1);
```

#### `Context::takesRest(): Context`

[](#contexttakesrest-context)

Takes the rest of parameters.

```
use Nemorize\Curried\Curried;
$context = Curried::from(function ($foo, $bar, $baz) {
    return $foo . $bar . $baz;
})->takes(0)->takesRest();
```

#### `Context::withStatic(int $position): Closure`

[](#contextwithstaticint-position-closure)

Binds a parameter at the given position to the closure.
Returned closure returns a `Context` for the next parameter.

```
use Nemorize\Curried\Curried;
$context = Curried::from(function ($foo, $bar) {
    return $foo . $bar;
})->takes(0)->withStatic(1)('bar');
```

#### `Context::generate(): Closure`

[](#contextgenerate-closure)

Generates a curried function.

```
use Nemorize\Curried\Curried;
$curried = Curried::from(function ($foo, $bar) {
    return $foo . $bar;
})->takes(0)->takes(1)->generate();
$curried('foo')('bar'); // 'foobar'
```

Examples
--------

[](#examples)

### Plus one to each element of an array

[](#plus-one-to-each-element-of-an-array)

```
use Nemorize\Curried\Curried;
$map = Curried::from(array_map(...))
    ->takes(0)
    ->takes(1)
    ->generate();
$plusOneEach = $map(fn (int $x) => $x + 1);
$plusOneEach([1, 2, 3]); // [2, 3, 4]
```

### Sum of an array

[](#sum-of-an-array)

```
use Nemorize\Curried\Curried;
$sum = Curried::from(array_reduce(...))
    ->takes(1)
    ->withStatic(0)(fn (int $x, int $y) => $x + $y)
    ->generate();
$sum([1, 2, 3]); // 6
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1185d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/12807795da10cb0139c1cc631cb308d9ed8a4a0d48348c733266bfdddb580ed5?d=identicon)[nemorize](/maintainers/nemorize)

---

Top Contributors

[![nemorize](https://avatars.githubusercontent.com/u/51209191?v=4)](https://github.com/nemorize "nemorize (2 commits)")

### Embed Badge

![Health badge](/badges/nemorize-curried/health.svg)

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

###  Alternatives

[outl1ne/nova-color-field

A Laravel Nova Color Picker field.

26249.4k](/packages/outl1ne-nova-color-field)[mremi/contact-bundle

Implementation of a contact form for Symfony2

2712.4k2](/packages/mremi-contact-bundle)[tlr/html-table-builder

An HTML Table Builder

1040.1k](/packages/tlr-html-table-builder)[phpstrap/phpstrap

Bootstrap layout generator

1214.7k](/packages/phpstrap-phpstrap)

PHPackages © 2026

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