PHPackages                             yuhanz/ramda-php - 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. yuhanz/ramda-php

ActiveLibrary

yuhanz/ramda-php
================

Functional programming library immitating ramdajs. https://github.com/yuhanz/ramda-php

19142PHP

Since Sep 4Pushed 8y ago2 watchersCompare

[ Source](https://github.com/yuhanz/ramda-php)[ Packagist](https://packagist.org/packages/yuhanz/ramda-php)[ RSS](/packages/yuhanz-ramda-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ramda-php
=========

[](#ramda-php)

This is a PHP implementation of ramda.js - a functional programming library. ()

So far only the curry functions and part of the functions implemented. The library is capable of doing the what's in the ramda.js examples.

### Implemented Methods

[](#implemented-methods)

- add
- addIndex
- adjust
- all
- allPass
- allUniq
- always
- and
- any
- anyPass
- ap
- aperture
- append
- apply
- applySpec
- assoc
- assocPath
- binary
- bind
- both
- call
- chain
- clamp
- clone
- comparator
- complement
- compose
- composeK
- composeP
- concat
- cond
- construct
- constructN
- contains
- converge
- countBy
- curry
- curryN
- dec
- defaultTo
- difference
- differenceWith
- dissoc
- dissocPath
- divide
- drop
- dropLast
- dropLastWhile
- dropRepeats
- dropRepeatsWith
- dropWhile
- either
- empty
- eqBy
- eqProps
- equals
- evolve
- filter
- find
- findIndex
- findLast
- findLastIndex
- flatten
- flip
- forEach
- fromPairs
- groupBy
- gt
- gte
- has
- hasIn
- head
- identical
- identity
- ifElse
- inc
- indexBy
- indexOf
- init
- insert
- insertAll
- internal
- intersection
- intersectionWith
- intersperse
- into
- invert
- invertObj
- invoker
- is
- isArrayLike
- isEmpty
- isNil
- join
- juxt
- keys
- keysIn
- last
- lastIndexOf
- length
- lens
- lensIndex
- lensPath
- lensProp
- lift
- liftN
- lt
- lte
- map
- mapAccum
- mapAccumRight
- mapObjIndexed
- match
- mathMod
- max
- maxBy
- mean
- median
- memoize
- merge
- mergeAll
- mergeWith
- mergeWithKey
- min
- minBy
- modulo
- multiply
- nAry
- negate
- none
- not
- nth
- nthArg
- objOf
- of
- omit
- once
- or
- over
- pair
- partial
- partialRight
- partition
- path
- pathEq
- pathOr
- pathSatisfies
- pick
- pickAll
- pickBy
- pipe
- pipeK
- pipeP
- pluck
- prepend
- product
- project
- prop
- propEq
- propIs
- propOr
- propSatisfies
- props
- range
- reduce
- reduceBy
- reduceRight
- reduced
- reject
- remove
- repeat
- replace
- reverse
- scan
- sequence
- set
- slice
- sort
- sortBy
- split
- splitAt
- splitEvery
- splitWhen
- subtract
- sum
- symmetricDifference
- symmetricDifferenceWith
- tail
- take
- takeLast
- takeLastWhile
- takeWhile
- tap
- test
- times
- toLower
- toPairs
- toPairsIn
- toString
- toUpper
- transduce
- transpose
- traverse
- trim
- tryCatch
- type
- unapply
- unary
- uncurryN
- unfold
- union
- unionWith
- uniq
- uniqBy
- uniqWith
- unless
- unnest
- update
- useWith
- values
- valuesIn
- view
- when
- where
- whereEq
- without
- wrap
- xprod
- zip
- zipObj
- zipWith

### Introduced Methods

[](#introduced-methods)

R::$flatten1 - flatten in non-recursive way (for 1 depth only).

### How to Use

[](#how-to-use)

Compose functions:

```
  require_once 'ramda.php';

  $getIncompleteTaskSummaries = function($membername) {
    return (R::$compose)(
      (R::$sortBy)((R::$prop)('dueDate')),
      (R::$map)((R::$pick)(['id', 'dueDate', 'title', 'priority'])),
      (R::$reject)((R::$propEq)('complete', true)),
      (R::$filter)((R::$propEq)('username', $membername)),
      (R::$prop)('tasks'));
  };

```

Use the function on data:

```
  $data = [
      'result' => "SUCCESS",
      'interfaceVersion' => "1.0.3",
      'requested' => "10/17/2013 15:31:20",
      'lastUpdated' => "10/16/2013 10:52:39",
      'tasks' => [
          ['id' => 104, 'complete' => false,            'priority' => "high",
                    'dueDate' => "2013-11-29",      'username' => "Scott",
                    'title' => "Do something",      'created' => "9/22/2013"],
          ['id' => 105, 'complete' => false,            'priority' => "medium",
                    'dueDate' => "2013-11-22",      'username' => "Lena",
                    'title' => "Do something else", 'created' => "9/22/2013"],
          ['id' => 107, 'complete' => false,             'priority' => "high",
                    'dueDate' => "2013-11-22",      'username' => "Mike",
                    'title' => "Fix the foo",       'created' => "9/22/2013"],
          ['id' => 108, 'complete' => false,            'priority' => "low",
                    'dueDate' => "2013-11-15",      'username' => "Punam",
                    'title' => "Adjust the bar",    'created' => "9/25/2013"],
          ['id' => 110, 'complete' => false,            'priority' => "medium",
                    'dueDate' => "2013-11-15",      'username' => "Scott",
                    'title' => "Rename everything", 'created' => "10/2/2013"],
          ['id' => 112, 'complete' => true,             'priority' => "high",
                    'dueDate' => "2013-11-27",      'username' => "Lena",
                    'title' => "Alter all quuxes",  'created' => "10/5/2013"],
          ['id' => 122, 'complete' => false,             'priority' => "high",
                    'dueDate' => "2013-11-01",      'username' => "Mike",
                    'title' => "Fix the bar",       'created' => "9/22/2013"],
          ['id' => 123, 'complete' => true,             'priority' => "high",
                    'dueDate' => "2013-11-22",      'username' => "Mike",
                    'title' => "Fix the foobar",       'created' => "9/22/2013"],

      ]
  ];
  $tasks = $getIncompleteTaskSummaries("Mike")($data);
  print_r($tasks);

```

Outputs:

```
(
    [0] => Array
        (
            [id] => 122
            [dueDate] => 2013-11-01
            [title] => Fix the bar
            [priority] => high
        )

    [1] => Array
        (
            [id] => 107
            [dueDate] => 2013-11-22
            [title] => Fix the foo
            [priority] => high
        )

)

```

Note: as a defect of PHP compiler, static method `R::$add(1,2)` wouldn't compile. To get around, place the static method inside parenthesis `(R::$add)(1,2)`

Curry functions:

(Note: `R::$_` is the placeholder parameter.)

```
  $f3 = function($a, $b, $c) {
      return $a*2+$b*3+$c*4;
  };
  $c = R::curry($f3);
  $cc = $c(R::$_,2,R::$_);
  print_r($cc(1,3));

```

Outputs:

```
  20

```

(More examples can be found in the /tests folder.)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

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://www.gravatar.com/avatar/6759a59e2488266f3d25e08da53b9f08d8a51593d322d7211451a4463be353d6?d=identicon)[yuhanz](/maintainers/yuhanz)

---

Top Contributors

[![yuhanz](https://avatars.githubusercontent.com/u/462969?v=4)](https://github.com/yuhanz "yuhanz (61 commits)")

---

Tags

functional-programmingphp

### Embed Badge

![Health badge](/badges/yuhanz-ramda-php/health.svg)

```
[![Health](https://phpackages.com/badges/yuhanz-ramda-php/health.svg)](https://phpackages.com/packages/yuhanz-ramda-php)
```

PHPackages © 2026

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