PHPackages                             sergiors/prelude - 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. sergiors/prelude

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

sergiors/prelude
================

Functional library

1.0.1-alpha(8y ago)48833[1 issues](https://github.com/sergiors/prelude/issues)MITPHPPHP ^7.1

Since Jan 13Pushed 8y ago6 watchersCompare

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

READMEChangelogDependencies (8)Versions (3)Used By (0)

Prelude
-------

[](#prelude)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/41fa955affdf4689351bf52f629a7b718660497bd17f4fbd29bea423ce3835c2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73657267696f72732f7072656c7564652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sergiors/prelude/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/144d9438c78bb41f303291bdce2be3e06b5e1f7afdd2bdf2363445c30385928c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73657267696f72732f7072656c7564652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sergiors/prelude/?branch=master)[![Build Status](https://camo.githubusercontent.com/afe121665fa565cc6faf5bd992654f2b2bfd250b33cb6f8a3c664b895c1aa081/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73657267696f72732f7072656c7564652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sergiors/prelude/build-status/master)

Install
-------

[](#install)

```
composer require sergiors/prelude "dev-master"
```

How to use
----------

[](#how-to-use)

```
use function Prelude\cond;
use function Prelude\equals;
use function Prelude\always;

$fn = cond([
    [equals(0), always('water freezes at 0°C')],
    [equals(100), always('water boils at 100°C')],
    [always(true), function ($temp) {
        return 'nothing special happens at '.$temp.'°C';
    }]
]);

echo $fn(0); // => water freezes at 0°C
echo $fn(50); // => nothing special happens at 50°C
echo $fn(100); // => water boils at 100°C
```

```
use function Prelude\has;

$hasName = has('name');
echo $hasName(['name' => 'Jimi']); // => true
echo $hasName([]); // => false
```

```
use const Prelude\id;
use const Prelude\isEmpty;
use function Prelude\ifElse;
use function Prelude\always;

$fn = ifElse(isEmpty)
    (always(true))
    (always(false));
echo $fn([]); // => true
echo $fn(null); // => true
echo $fn(false); // => true
echo $fn('James'); // => false
```

```
use function Prelude\head;

echo head([1, 2, 3]); // => 1
```

```
use function Prelude\tail;

echo tail([1, 2, 3]); // => [2, 3]
```

API
---

[](#api)

[**Full API Documentation**](docs/index.md)

Thanks
------

[](#thanks)

[Marcelo Camargo](https://github.com/haskellcamargo)

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.9% 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 ~324 days

Total

2

Last Release

3129d ago

PHP version history (2 changes)1.0.0-alphaPHP ^7

1.0.1-alphaPHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/75b67763139f7a8c96302299f5a40a386d565829af3061bb55465c8808d54428?d=identicon)[sergiors](/maintainers/sergiors)

---

Top Contributors

[![sergiors](https://avatars.githubusercontent.com/u/2046276?v=4)](https://github.com/sergiors "sergiors (124 commits)")[![arojunior](https://avatars.githubusercontent.com/u/7604033?v=4)](https://github.com/arojunior "arojunior (10 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (4 commits)")

---

Tags

functional-programmingmonadphpfunctional-programmingmonad

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sergiors-prelude/health.svg)

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

###  Alternatives

[marcosh/lamphpda

A collection of functional programming data structures

12214.1k4](/packages/marcosh-lamphpda)[react/partial

Partial function application.

114382.5k13](/packages/react-partial)[mpetrovich/dash

A functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.

10429.7k1](/packages/mpetrovich-dash)[chemem/bingo-functional

A simple functional programming library.

687.0k3](/packages/chemem-bingo-functional)[chippyash/monad

Functional programming Monad support

2728.4k8](/packages/chippyash-monad)[shrink0r/monatic

Fiddling with the monad concept in php

245.3k2](/packages/shrink0r-monatic)

PHPackages © 2026

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