PHPackages                             gerritdrost/phenum - 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. gerritdrost/phenum

ActiveLibrary

gerritdrost/phenum
==================

Because PHP needs Enums

v1.0.2(2y ago)14103.6k↓44.1%42MITPHPPHP &gt;=8.1.0

Since Mar 30Pushed 2y ago2 watchersCompare

[ Source](https://github.com/gerritdrost/phenum)[ Packagist](https://packagist.org/packages/gerritdrost/phenum)[ RSS](/packages/gerritdrost-phenum/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (2)

Note
====

[](#note)

[PHP has native support for enums since version 8.1](https://www.php.net/manual/en/language.types.enumerations.php). Use those if you have the chance.

phenum
======

[](#phenum)

Enums for PHP, nuff said.

Description
-----------

[](#description)

A lot of people love enums. Unfortunately, PHP does not support them out-of-the-box, it requires `SplEnum` to be installed. I stumbled across this problems as well and decided to attempt to solve it: say hello to phenum.

Why phenum?
-----------

[](#why-phenum)

Because it's easy to use and has some cool features. Enum values are actually are singleton objects, they have their own instance and can have their own variables! Also the library provides utility classes like the EnumMap which can be used to map values to Enums, something not possible with regular PHP arrays.

Dependencies
------------

[](#dependencies)

PHP 8.1 or newer.

Setup
-----

[](#setup)

Include [`gerritdrost/phenum`](https://packagist.org/packages/gerritdrost/phenum) using composer.

Documentation
-------------

[](#documentation)

- [Getting Started](docs/getting-started.md)
- [Constructors](docs/constructors.md)
- [Example Usage](docs/example-usage.md)
- [EnumMap](docs/enum-map.md)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~1550 days

Total

3

Last Release

967d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.5.0

v1.0.2PHP &gt;=8.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5630275?v=4)[Gerrit Drost](/maintainers/gerritdrost)[@gerritdrost](https://github.com/gerritdrost)

---

Top Contributors

[![gerritdrost](https://avatars.githubusercontent.com/u/5630275?v=4)](https://github.com/gerritdrost "gerritdrost (15 commits)")[![dereckson](https://avatars.githubusercontent.com/u/135563?v=4)](https://github.com/dereckson "dereckson (1 commits)")[![kovinet](https://avatars.githubusercontent.com/u/707846?v=4)](https://github.com/kovinet "kovinet (1 commits)")

---

Tags

enumlibraryphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gerritdrost-phenum/health.svg)

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

PHPackages © 2026

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