PHPackages                             cdn77/functions - 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. cdn77/functions

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

cdn77/functions
===============

PHP Functions

0.2.7(2mo ago)0105.0k—4.4%[2 PRs](https://github.com/cdn77/PhpFunctions/pulls)MITPHPPHP ^8.3CI passing

Since Feb 9Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/cdn77/PhpFunctions)[ Packagist](https://packagist.org/packages/cdn77/functions)[ RSS](/packages/cdn77-functions/feed)WikiDiscussions 0.2.x Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (20)Used By (0)

PHP Functions
=============

[](#php-functions)

[![GitHub Actions](https://github.com/cdn77/PhpFunctions/workflows/CI/badge.svg)](https://github.com/cdn77/PhpFunctions/actions?query=workflow%3A%22CI%22+branch%3Amaster)[![Code Coverage](https://camo.githubusercontent.com/701db357f74c8b887a1d435a0a012d43e154662b798f3d643e64077a03aeed52/68747470733a2f2f636f6465636f762e696f2f67682f63646e37372f50687046756e6374696f6e732f6272616e63682f302e322e782f67726170682f62616467652e737667)](https://codecov.io/gh/cdn77/PhpFunctions/branch/0.2.x)[![Downloads](https://camo.githubusercontent.com/598e27112d45e6040b2ad17880ffd456b7b2a28be225da3d99e85c451715a1da/68747470733a2f2f706f7365722e707567782e6f72672f63646e37372f66756e6374696f6e732f642f746f74616c2e737667)](https://packagist.org/packages/cdn77/functions)[![Packagist](https://camo.githubusercontent.com/2a18ccea377d44c7376f7bb91e7b62ba8a38eaae1e733845eec3ee0df099b84f/68747470733a2f2f706f7365722e707567782e6f72672f63646e37372f66756e6374696f6e732f762f737461626c652e737667)](https://packagist.org/packages/cdn77/functions)

Functions
---------

[](#functions)

### absurd()

[](#absurd)

Function that should have never been called. Useful for `default` case in exhaustive matching.

### assert\_return()

[](#assert_return)

Asserts the value via the expression and returns it.

It's useful when you want to assert inline so for example you can keep the arrow function in place.

It uses native `assert()` internally.

```
use function Cdn77\Functions\assert_return;

array_map(
    fn (mixed $value) => new RequiresInt(assert_return($value, is_int(...))),
    [1, 2, 3]
);
```

### noop()

[](#noop)

Does nothing. Useful e.g. for `match` expression that currently supports single-line expressions in blocks.

```
match ($val) {
  '1' => throw new Exception,
  '2' => foo(),
  default => noop(),
};
```

Ds
--

[](#ds)

### `mapFromEntries()`

[](#mapfromentries)

Creates a map from an iterable of entries.

```
use function Cdn77\Functions\mapFromEntries;

$map = mapFromEntries([
  ['foo', 'bar'],
  ['baz', 'qux'],
]);

assert($map->get('foo') === 'bar');
```

### `mappedMapsFromIterable()`

[](#mappedmapsfromiterable)

Groups an iterable into a `Map` using a mapper that returns nested `Pair`s.

```
use Ds\Pair;
use function Cdn77\Functions\mappedMapsFromIterable;

$map = mappedMapsFromIterable(
    ['a' => 1, 'b' => 2, 'c' => 1],
    static fn (string $key, int $value) => new Pair($value, new Pair($key, $key . '_')),
);

assert($map->get(1)->get('a') === 'a_');
assert($map->get(1)->get('c') === 'c_');
assert($map->get(2)->get('b') === 'b_');
```

Iterable
--------

[](#iterable)

### find()

[](#find)

Finds a value in an iterable.

```
use function Cdn77\Functions\Iterable\find;

$iterable = [0, 1, 2, 3];
$option = find($iterable, static fn (mixed $_, int $value) => $value < 2);

assert($option->unwrap() === 0);
```

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance87

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 67% 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 ~117 days

Recently: every ~142 days

Total

17

Last Release

53d ago

PHP version history (5 changes)0.1.0PHP ^7.4 || ^8.0

0.1.3PHP ^8.0

0.1.5PHP ^8.1

0.2.0PHP ^8.2

0.2.6PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/af6552e906a40b12da9488a4dddfa4f9f4c0fecde220e7391accdd615523c7ee?d=identicon)[simPod](/maintainers/simPod)

![](https://www.gravatar.com/avatar/3930b669c9db4083930e36c23f5f0d36d53935aa1dfd1c8cbcfed2a4db165b94?d=identicon)[marek.fiala](/maintainers/marek.fiala)

---

Top Contributors

[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (65 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (30 commits)")[![trearcul](https://avatars.githubusercontent.com/u/882375?v=4)](https://github.com/trearcul "trearcul (2 commits)")

---

Tags

hacktoberfestphpphp-functionsphpgeneratorsfunctionsdsnoopneverabsurd

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cdn77-functions/health.svg)

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

###  Alternatives

[php-ds/php-ds

Specialized data structures as alternatives to the PHP array

4108.8M134](/packages/php-ds-php-ds)[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[nilportugues/php_todo

Looks into the code using a user-defined list of to-do phrases and stops commit if the total amount increased or is above a threshold.

1210.0k](/packages/nilportugues-php-todo)

PHPackages © 2026

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