PHPackages                             rikmeijer/functional-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rikmeijer/functional-php

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

rikmeijer/functional-php
========================

Functional primitives for PHP

1.0(1y ago)01.2kMITPHPPHP ^7.1|~8

Since Aug 29Pushed 1y agoCompare

[ Source](https://github.com/rikmeijer/functional-php)[ Packagist](https://packagist.org/packages/rikmeijer/functional-php)[ GitHub Sponsors](https://github.com/lstrojny)[ RSS](/packages/rikmeijer-functional-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Functional PHP: Functional primitives for PHP
=============================================

[](#functional-php-functional-primitives-for-php)

[![Test](https://github.com/lstrojny/functional-php/actions/workflows/test.yaml/badge.svg)](https://github.com/lstrojny/functional-php/actions/workflows/test.yaml)

*NOTE:* functional-php used to come with a C extension that implemented most of the functions natively. As the performance differences weren’t that huge compared to the maintenance cost it has been removed.

A set of functional primitives for PHP, heavily inspired by [Scala’s traversable collection](http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/collection/Traversable.html), [Dojo’s array functions](http://dojotoolkit.org/reference-guide/quickstart/arrays.html) and [Underscore.js](http://underscorejs.org/)

- Works with arrays and everything implementing interface `Traversable`
- Consistent interface: for functions taking collections and callbacks, first parameter is always the collection, then the callback. Callbacks are always passed `$value`, `$index`, `$collection`. Strict comparison is the default but can be changed
- Calls 5.3 closures as well as usual callbacks
- All functions reside in namespace `Functional` to not raise conflicts with any other extension or library

[![Functional Comic](https://camo.githubusercontent.com/63becd4ac41d0a381f17d2b2c18487a2c0f7887c24a5638c83cf64f409889540/687474703a2f2f696d67732e786b63642e636f6d2f636f6d6963732f66756e6374696f6e616c2e706e67)](http://xkcd.com/1270/)

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

[](#installation)

Run the following command in your project root:

```
composer require lstrojny/functional-php

```

Docs
----

[](#docs)

[Read the docs](docs/functional-php.md)

Contributing
------------

[](#contributing)

1. Fork and `git clone` the project
2. Install dependencies via `composer install`
3. Run the tests via `composer run tests`
4. Write code and create a PR

Mailing lists
-------------

[](#mailing-lists)

- General help and development list:
- Commit list:

Thank you
---------

[](#thank-you)

- [Richard Quadling](https://github.com/RQuadling) and [Pierre Joye](https://github.com/pierrejoye) for Windows build help
- [David Soria Parra](https://github.com/dsp) for various ideas and the userland version of `Functional\flatten()`
- [Max Beutel](https://github.com/maxbeutel) for `Functional\unique()`, `Functional\invoke_first()`, `Functional\invoke_last()` and all the discussions
- [An Phan](https://github.com/phanan) for [many](https://github.com/lstrojny/functional-php/pulls?q=author%3Aphanan)great contributions

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 86.1% 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

626d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d386b4ade493b5756f5e89ea5cd6e7272b0858d26ca88ffddfcaab76b2e1bc7?d=identicon)[rikmeijer](/maintainers/rikmeijer)

---

Top Contributors

[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (469 commits)")[![phanan](https://avatars.githubusercontent.com/u/8056274?v=4)](https://github.com/phanan "phanan (11 commits)")[![rquadling](https://avatars.githubusercontent.com/u/12801?v=4)](https://github.com/rquadling "rquadling (6 commits)")[![alexeyshockov](https://avatars.githubusercontent.com/u/203120?v=4)](https://github.com/alexeyshockov "alexeyshockov (5 commits)")[![jasonmm](https://avatars.githubusercontent.com/u/2171623?v=4)](https://github.com/jasonmm "jasonmm (5 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (4 commits)")[![gabrielhomsi](https://avatars.githubusercontent.com/u/9436096?v=4)](https://github.com/gabrielhomsi "gabrielhomsi (4 commits)")[![rodnaph](https://avatars.githubusercontent.com/u/447579?v=4)](https://github.com/rodnaph "rodnaph (3 commits)")[![bor0](https://avatars.githubusercontent.com/u/1620929?v=4)](https://github.com/bor0 "bor0 (3 commits)")[![krtek4](https://avatars.githubusercontent.com/u/963772?v=4)](https://github.com/krtek4 "krtek4 (3 commits)")[![someonewithpc](https://avatars.githubusercontent.com/u/4998043?v=4)](https://github.com/someonewithpc "someonewithpc (3 commits)")[![leocavalcante](https://avatars.githubusercontent.com/u/183722?v=4)](https://github.com/leocavalcante "leocavalcante (2 commits)")[![rikmeijer](https://avatars.githubusercontent.com/u/448159?v=4)](https://github.com/rikmeijer "rikmeijer (2 commits)")[![soutoner](https://avatars.githubusercontent.com/u/2651613?v=4)](https://github.com/soutoner "soutoner (2 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (2 commits)")[![pyldin601](https://avatars.githubusercontent.com/u/8050895?v=4)](https://github.com/pyldin601 "pyldin601 (2 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (2 commits)")[![mschwager](https://avatars.githubusercontent.com/u/1724818?v=4)](https://github.com/mschwager "mschwager (2 commits)")[![dsp](https://avatars.githubusercontent.com/u/14013?v=4)](https://github.com/dsp "dsp (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")

---

Tags

functional

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/rikmeijer-functional-php/health.svg)

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

###  Alternatives

[lstrojny/functional-php

Functional primitives for PHP

2.0k7.3M48](/packages/lstrojny-functional-php)[nikic/iter

Iteration primitives using generators

1.1k5.9M38](/packages/nikic-iter)[lambdish/phunctional

λ PHP functional library

3612.0M23](/packages/lambdish-phunctional)[ihor/nspl

Non-standard PHP library (NSPL) - functional primitives toolbox and more

381368.5k](/packages/ihor-nspl)[qaribou/immutable.php

Immutable, highly-performant collections, well-suited for functional programming and memory-intensive applications.

344146.0k](/packages/qaribou-immutablephp)[crell/fp

Functional utilities for PHP 8 and later

91429.8k11](/packages/crell-fp)

PHPackages © 2026

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