PHPackages                             phpninjas/comprehensions - 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. phpninjas/comprehensions

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

phpninjas/comprehensions
========================

v0.1.0(11y ago)0812PHP

Since Jan 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/phpninjas/Comprehensions)[ Packagist](https://packagist.org/packages/phpninjas/comprehensions)[ RSS](/packages/phpninjas-comprehensions/feed)WikiDiscussions master Synced today

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

For Comprehensions
==================

[](#for-comprehensions)

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

[](#installation)

composer.json

```
{
  "require": {
    "phpninjas/comprehensions":"dev-master"
  }
}
```

Options
=======

[](#options)

Imagine if you're using Doctrine, and you don't know if attempting to find an object by id will result in an object or a null value. Thus you might want to wrap the object into an option. It will either be Some\[DbObject\] or None. However, you can still perform mapping operations on it as if it were going to be a DbObject. Thus you negate the need for null checks.

```
$product = $entityManager->find('Product', "some identifier");

if ($product === null) {
    return $product->getName();
}
return "";
```

becomes

```
$product = Option($entityManager->find('Product', "some identifier"));
$name = $product->map(function($p){
  return $p->getName();
});

return $name->getOrElse("");
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

4195d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/460cc058bda3ffbaade325c31806d0c9a677e9f605f22b1d191485d24677c8e3?d=identicon)[james.turner.phpninja@gmail.com](/maintainers/james.turner.phpninja@gmail.com)

---

Top Contributors

[![james-turner](https://avatars.githubusercontent.com/u/437893?v=4)](https://github.com/james-turner "james-turner (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpninjas-comprehensions/health.svg)

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

PHPackages © 2026

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