PHPackages                             im0rtality/underscore - 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. im0rtality/underscore

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

im0rtality/underscore
=====================

Functional programming library for PHP

v0.6.1(10y ago)415.2k5[2 issues](https://github.com/im0rtality/underscore/issues)[2 PRs](https://github.com/im0rtality/underscore/pulls)MITPHPPHP &gt;=5.4

Since Mar 11Pushed 9y ago5 watchersCompare

[ Source](https://github.com/im0rtality/underscore)[ Packagist](https://packagist.org/packages/im0rtality/underscore)[ RSS](/packages/im0rtality-underscore/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

Underscore
==========

[](#underscore)

[![Build Status](https://camo.githubusercontent.com/4530dfbed150cc792858b9bd41547abb682540010306eac76821a04ddb948add/68747470733a2f2f7472617669732d63692e6f72672f496d307274616c6974792f556e64657273636f72652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Im0rtality/Underscore)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/8104108352483e5bd77e3bd486dc411b99aef9754309d1fb6cf1701822aa40e4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496d307274616c6974792f556e64657273636f72652f6261646765732f7175616c6974792d73636f72652e706e673f733d61333630373135663439656134626261323235623739393131343639383163613830623631333337)](https://scrutinizer-ci.com/g/Im0rtality/Underscore/)[![Code Coverage](https://camo.githubusercontent.com/1e0b2188a537d9d353758540fff01d238647145f46a5796d5451f0ba638190e3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496d307274616c6974792f556e64657273636f72652f6261646765732f636f7665726167652e706e673f733d65396335363639663330306234643863623936643066613836343531313961623534366662643632)](https://scrutinizer-ci.com/g/Im0rtality/Underscore/)[![SensioLabsInsight](https://camo.githubusercontent.com/9ee53f7c7f28484d2027982f6324ae699bf33e19b46d21e73f1bda676816834f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64376566343461662d373037642d343633382d623931652d3866643034336463393965302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d7ef44af-707d-4638-b91e-8fd043dc99e0)

Functional programming library for PHP

Code example
============

[](#code-example)

Library aims to be as easy to use as possible. Here is example of doing some not-so-meaningful operations to show off:

```
    Underscore::from([1,2,3,4,5])
            // convert array format
        ->map(function($num) { return ['number' => $num];})
            // filter out odd elements
        ->filter(function($item) { return ($item['number'] % 2) == 0;})
            // vardump elements
        ->invoke(function($item) { var_dump($item);})
            // changed my mind, I only want numbers
        ->pick('number')
            // add numbers to 1000
        ->reduce(function($sum, $num) { $sum += $num; return $sum; }, 1000)
            // take result
        ->value();
            // 1006
```

Motivation
==========

[](#motivation)

Originaly I needed functional programming magic for other project, so had to pick one lib or write my own.

There is several PHP ports of UnderscoreJS, however none of those fit my requirements (nice code, easy to write, standardized):

- [brianhaveri/Underscore.php](https://github.com/brianhaveri/Underscore.php) - not maintained, messy code
- [Anahkiasen/underscore-php](https://github.com/Anahkiasen/underscore-php) - Laravel4 package =&gt; incompatible with PSR-2

Installation
============

[](#installation)

Via composer:

```
$ composer require im0rtality/underscore:*

```

Composer docs recommend to use specific version. You can look them up in [Releases](https://github.com/Im0rtality/Underscore/releases).

Documentation
=============

[](#documentation)

See [wiki](https://github.com/Im0rtality/Underscore/wiki/Intro)

Tests
=====

[](#tests)

Tests generate coverage reports in clover.xml format

```
$ vendor/bin/phpunit

```

License
=======

[](#license)

MIT License: You can do whatever you want as long as you include the original copyright.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.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

Every ~68 days

Total

12

Last Release

3732d ago

PHP version history (2 changes)v0.1PHP &gt;=5.3.0

v0.4.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d0c2ed4ef6020c0ba50e9f5b30972ea9ec5b17a0c82271ffae81125dd3c2610?d=identicon)[Im0rtality](/maintainers/Im0rtality)

---

Top Contributors

[![Im0rtality](https://avatars.githubusercontent.com/u/1804210?v=4)](https://github.com/Im0rtality "Im0rtality (210 commits)")[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (49 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/im0rtality-underscore/health.svg)

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

PHPackages © 2026

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