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

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

joaomfrebelo/enum
=================

Implementation of enumeration in php

4.0.0(4w ago)0347↓57.1%[1 PRs](https://github.com/joaomfrebelo/Enum/pulls)4MITPHPPHP 8.3.\*CI failing

Since Feb 16Pushed 4w ago1 watchersCompare

[ Source](https://github.com/joaomfrebelo/Enum)[ Packagist](https://packagist.org/packages/joaomfrebelo/enum)[ Docs](https://github.com/joaomfrebelo/Enum)[ RSS](/packages/joaomfrebelo-enum/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (13)Used By (4)

Enum
====

[](#enum)

Enum is a workaround to work with Enumeration on PHP

Example
-------

[](#example)

```
/**
 * The enumeration class
 */
final class MyExample extends \Rebelo\Enum\AEnum
{
    const EXAMPLE_1 = 1;
    const EXAMPLE_2 = 2;

    public function __construct($value)
    {
        parent::__construct($value);
    }
}

class Foo
{
    /**
     *
     * This method will only acept values of MyExample enumeration class
     *
     * @param MyExample $myExample
     */
    public function myMethod(MyExample $myExample)
    {
        $value = $myExample->get();
        // do stuff
    }
}

$foo = new foo();
$foo->myMethod(new MyExample(MyExample::EXAMPLE_1));
```

Install
-------

[](#install)

Via Composer

```
$ composer require joaomfrebelo/enum
```

License
-------

[](#license)

Copyright (c) 2019 João M F Rebelo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance94

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.8% 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 ~266 days

Recently: every ~501 days

Total

11

Last Release

29d ago

Major Versions

1.1.1.x-dev → 2.0.02020-09-26

2.0.4 → 3.0.02023-02-03

3.0.0 → 4.0.02026-06-01

PHP version history (6 changes)1.0.0PHP ^7.2

2.0.0PHP ^7.4

2.0.3PHP ^7.4 || ^8.0

2.0.4PHP ^7.4 || ^8.0 || ^8.1

3.0.0PHP 8.0.\* || 8.1.\* || 8.2.\*

4.0.0PHP 8.3.\*

### Community

Maintainers

![](https://www.gravatar.com/avatar/909b2a0bdc281c7125fc264a04f0da1538f16cbad859501919565f8e21dde18d?d=identicon)[joaomfrebelo](/maintainers/joaomfrebelo)

---

Top Contributors

[![joaomfrebelo](https://avatars.githubusercontent.com/u/2965955?v=4)](https://github.com/joaomfrebelo "joaomfrebelo (15 commits)")[![pchouse](https://avatars.githubusercontent.com/u/47385696?v=4)](https://github.com/pchouse "pchouse (1 commits)")

---

Tags

enumeration

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

49753.5M104](/packages/marc-mabe-php-enum)[cerbero/enum

Zero-dependencies package to supercharge enum functionalities.

359227.5k2](/packages/cerbero-enum)[cerbero/laravel-enum

Laravel package to supercharge enum functionalities.

18995.6k](/packages/cerbero-laravel-enum)[emreyarligan/enum-concern

A PHP package for effortless Enumeration handling with Laravel Collections 📦 ✨

21260.4k2](/packages/emreyarligan-enum-concern)[rexlabs/enum

Enumeration (enum) implementation for PHP

47502.6k2](/packages/rexlabs-enum)[thunderer/platenum

PHP enum library

36146.7k](/packages/thunderer-platenum)

PHPackages © 2026

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