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

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

emulgeator/enum
===============

A very simple library allowing you to define enums in PHP

1.0.1(4y ago)010.4k↓50%1MITPHPPHP &gt;=7

Since Feb 19Pushed 4y ago1 watchersCompare

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

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

enum
====

[](#enum)

A very simple library allowing you to define enums in PHP

Getting Started
---------------

[](#getting-started)

### Installing

[](#installing)

Run `composer require emulgeator/enum` to add this library as a dependency to your project

Usage
-----

[](#usage)

Just extend the class, define the possible values, and crate your own `constructors`:

```
use Emul\Enum\EnumAbstract;

class Status extends EnumAbstract
{
    const ENABLED  = 'enabled';
    const DISABLED = 'disabled';
    const DELETED  = 'deleted';

    public static function enabled(): self
    {
        return new self(self::ENABLED);
    }

    public static function disabled(): self
    {
        return new self(self::DISABLED);
    }

    public static function deleted(): self
    {
        return new self(self::DELETED);
    }

    protected static function getPossibleValues(): array
    {
        return [
            self::ENABLED,
            self::DISABLED,
            self::DELETED,
        ];
    }
}

$enabled  = Status::enabled();
$disabled = Status::disabled();
$deleted  = Status::createFromString('invalid'); // Throws exception

$enabled->isEqualToString('disabled'); // false
$enabled->isEqualTo($disabled); // false
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Every ~342 days

Total

2

Last Release

1572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81c871f43e6e6a837aabda1a7c6eca62b02bfcd6d3a59ed86c11414eedb29528?d=identicon)[emulgeator](/maintainers/emulgeator)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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