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

AbandonedArchivedLibrary

jdecool/enum
============

Just an another Enum implementation for PHP

v1.0.0(5y ago)11302MITPHPPHP ^8.0

Since Dec 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jdecool/enum)[ Packagist](https://packagist.org/packages/jdecool/enum)[ RSS](/packages/jdecool-enum/feed)WikiDiscussions main Synced 6d ago

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

Enum
====

[](#enum)

[![Build Status](https://github.com/jdecool/enum/workflows/CI/badge.svg)](https://github.com/jdecool/enum/actions?query=workflow%3ACI)[![Latest Stable Version](https://camo.githubusercontent.com/7da13f011da66216f02c46401a872ab99d774ddd47280a9bafe6049b50bc5d3e/68747470733a2f2f706f7365722e707567782e6f72672f6a6465636f6f6c2f656e756d2f762f737461626c652e706e67)](https://packagist.org/packages/jdecool/enum)

An another Enum implementation for PHP.

Deprecated
----------

[](#deprecated)

⚠️ This project is no longer actively maintained.

Native enum arrived to PHP in version 8.1: If your project is running PHP 8.1+ or your library has it as a minimum requirement you should use it instead of this library.

Why ?
-----

[](#why-)

Why creating an another enum package ?

I usually use two enum implementations depends on my needs: [myclabs/php-enum](https://github.com/myclabs/php-enum/) or [marc-mabe/php-enum](https://github.com/marc-mabe/php-enum).

I appreciate the first one `myclabs/php-enum` for its simplicity, but it has a big default: two access to the same enum value doesn't return the same class instance.

That's why, I sometimes use the second one `marc-mabe/php-enum` but its disadvantage is that is not possible to have private constant to represent our enum values. So those constant are publicly exposed.

This is why I've decided to create my own enum implementation, which have the simplicity of `myclabs/php-enum` with the power of `marc-mabe/php-enum`.

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

[](#installation)

This library require PHP &gt;= 8.0, you can easily install it using [Composer](https://getcomposer.org).

```
composer require jdecool/enum
```

Declaration
-----------

[](#declaration)

```
use JDecool\Enum\Enum;

class MyEnum extends Enum
{
    public const ENUM_1 = 'value_1';
    protected const ENUM_2 = 'value_2';
    private const ENUM_3 = 'value_3';
}
```

Usage
-----

[](#usage)

```
$value1 = MyEnum::ENUM_1();
$value2 = MyEnum::ENUM_2();
$value3 = MyEnum::ENUM_3();
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

1985d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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