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

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

uginroot/php-enum
=================

Php enum type

v2.6(6y ago)0331MITPHPPHP ^7.2

Since Jan 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/uginroot/php-enum)[ Packagist](https://packagist.org/packages/uginroot/php-enum)[ RSS](/packages/uginroot-php-enum/feed)WikiDiscussions master Synced today

READMEChangelog (10)DependenciesVersions (11)Used By (1)

Php enum type
=============

[](#php-enum-type)

Install
-------

[](#install)

```
composer require uginroot/php-enum:^2.3
```

Using
-----

[](#using)

```
use Uginroot\PhpEnum\Choice;
use Uginroot\PhpEnum\EnumAbstract;

class Month extends EnumAbstract {
    public const January = 1;
    public const February = 2;
}

$jun = new Month(Month::January);
$junName = Month::createByName('January');
$junValue = Month::createByValue(Month::January);

$jun->getValue(); // 1
$jun->getName();  // 'January'
$name = (string)$jun; // 'January'

$jun->is($junName);            // true
$jun->is($junValue);           // true
$jun->isName('January');       // true
$jun->isValue(Month::January); // true

// Immutable
$jun->setValue(Month::February); // new Month(Month::February)
$jun->setName('February'); // Month::createByName('February')

// Name and value variants
/** @var Choice $choice */
$choice = Month::getChoice();
$choice->getValues(); // [1, 2]
$choice->getNames();  // ['January', 'February']
$choice->getValue('January'); // 1
$choice->getName(Month::January); // 'January'
$choice->isValidName('January'); // true
$choice->isValidValue(Month::January); // true
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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 ~14 days

Recently: every ~19 days

Total

10

Last Release

2222d ago

Major Versions

v1.2 → v2.02020-03-02

PHP version history (3 changes)v1.0PHP ^7.1.3

v1.2PHP ^7.4

v2.3PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2391460?v=4)[Soroka Anton](/maintainers/uginroot)[@uginroot](https://github.com/uginroot)

---

Top Contributors

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

---

Tags

phptypeenum

### Embed Badge

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

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

###  Alternatives

[garoevans/php-enum

Convenient way to always have an Enum object available and utilise Spl Types if available.

19165.3k5](/packages/garoevans-php-enum)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21330.5k2](/packages/zakirullin-mess)[strictus/strictus

Strict Typing for local variables in PHP

1627.4k](/packages/strictus-strictus)[ducks-project/spl-types

Polyfill Module for SplType PHP extension. This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string

1033.1k](/packages/ducks-project-spl-types)

PHPackages © 2026

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