PHPackages                             convoflo/ordered-enum - 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. convoflo/ordered-enum

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

convoflo/ordered-enum
=====================

Give your enums an order. Provides utilities such as greaterThan, lessThan, min, max and more.

1.0.0(1y ago)028PHP

Since Dec 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/convoflo/ordered-enum)[ Packagist](https://packagist.org/packages/convoflo/ordered-enum)[ RSS](/packages/convoflo-ordered-enum/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Ordered Enum
================

[](#php-ordered-enum)

This package gives your enums an order. It provides helper utilities such as `->greaterThan()`, `->lessThan()`, `::min()`, `::max()` and more.

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

[](#installation)

You can install the package via composer:

```
composer require convoflo/ordered-enum
```

Usage
-----

[](#usage)

This is how an ordered enum can be defined.

```
use \Convoflo\OrderedEnum\OrderedBackedEnum;
use \Convoflo\OrderedEnum\OrderedTrait;

enum UserRole: string implements OrderedBackedEnum
{
    use OrderedTrait;

    case Admin = 'admin';
    case Regular = 'user';
    case Basic = 'basic';

    public static function order(): array
    {
        return [self::Basic, self::Regular, self::Admin];
    }
}
```

Here's how ordered enums are used with their helpers:

```
$showAdminConsole = $userRole->greaterThan(UserRole::Regular);
$showMinimalInterface = $userRole->lessThan(UserRole::Regular);

$isNotBasic = $userRole->greaterThanOrEqualsTo(UserRole::Regular);
$isNotAdmin = $userRole->lessThanOrEqualsTo(UserRole::Regular);

UserRole::min(UserRole::Basic, UserRole::Admin); // UserRole::Basic
UserRole::max(UserRole::Basic, UserRole::Admin); // UserRole::Admin

$highestRole = UserRole::max(); // UserRole::Admin
$lowestRole = UserRole::min(); // UserRole::Basic
```

Credits
-------

[](#credits)

- [Alex Demers](https://github.com/alexdemers)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

531d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/571c08e3cb4fb214015848023c9bfd3d9388c3fd967500bb99c16bba9c96a4a3?d=identicon)[alexdemers](/maintainers/alexdemers)

---

Top Contributors

[![alexdemers](https://avatars.githubusercontent.com/u/1834344?v=4)](https://github.com/alexdemers "alexdemers (4 commits)")

### Embed Badge

![Health badge](/badges/convoflo-ordered-enum/health.svg)

```
[![Health](https://phpackages.com/badges/convoflo-ordered-enum/health.svg)](https://phpackages.com/packages/convoflo-ordered-enum)
```

PHPackages © 2026

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