myclabs/php-enum
The enum PHP is missing, inspired from SplEnum observed · 2026-08-28
Health v2 · maintenance only
26/100
- Activity 7
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 4970
- days_rel: 596
- days_push: 558
- n_releases_24m: 1
Adoption not part of the score
2722 stars · 127 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A small PHP library providing an Enum base class, inspired by SplEnum, for PHP versions lacking native enums. It lets developers define enumerable constants as typed objects usable as parameter/return types with helper methods like from(), values(), and equals().
Use cases
- use enums as parameter and return types in PHP
- get a list of all possible enum values
- compare enum instances for equality
- create enum instances from dynamic values
- add methods to enum types
When to choose
- you are on PHP < 8.1 and need enum-like typed constants
- you want SplEnum behavior without installing a C extension
- you need enums with methods and type-hintable instances
When to avoid
- you are on PHP 8.1+ where native enums are built in
- you only need simple class constants
- you need a heavily developed actively evolving library
Facets
library · maturity maintenance
type-system serialization programming-languages developer-tools php enum spl-enum value-objects composer-package
1 source
- readme: https://github.com/myclabs/php-enum · fetched 2026-08-28 · 6c8a77f023b6
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| myclabs/php-enum | main | 26 |
For agents
markdown · JSON · MCP: product_card(name="myclabs/php-enum")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem