PHPackages                             bulychev/enums - 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. bulychev/enums

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

bulychev/enums
==============

Enums Helper Traits for PHP 8.1+

1.1.1(3y ago)2109MITPHPPHP ^8.1

Since Jan 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/EgorBulychev/EnumsHelper)[ Packagist](https://packagist.org/packages/bulychev/enums)[ Docs](https://github.com/EgorBulychev/EnumsHelper)[ RSS](/packages/bulychev-enums/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

Enums Helper Traits for PHP 8.1+ ❤

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

[](#installation)

> composer require bulychev/enums

Usage trait
-----------

[](#usage-trait)

```
/**
 * @method static int USER()
 * @method static int ADMIN()
 * @method static int ROOT()
 */
#[Property(Description::class)]
enum Role: int
{
    use EnumsHelper;

    #[Description('Standard user account')]
    case USER = 10;

    #[Description('User with advanced permissions')]
    case ADMIN = 50;

    #[Description('User with full permissions')]
    case ROOT = 99;
}
```

#### `__invoke & __callStatic`: int|string

[](#__invoke--__callstatic-intstring)

BackedEnum

```
Role::ADMIN(); // int(50)
Role::ROOT(); // int(99)
Role::MANAGER(); // throw new UndefinedEnumCaseException
```

UnitEnum

```
/**
 * @method static string RU()
 * @method static string KG()
 * @method static string EN()
 */
enum Lang
{
    use EnumsHelper;

    case RU;
    case KG;
    case EN;
}
Role::RU(); // string(2) "RU"
Role::KG(); // string(2) "KG"
Role::EN(); // string(2) "EN"
```

#### `names()`: array

[](#names-array)

```
Role::names();
// array(3) {
//   [0]=> string(4) "USER"
//   [1]=> string(5) "ADMIN"
//   [2]=> string(4) "ROOT"
// }
```

#### `values()`: array

[](#values-array)

```
Role::values();
// array(3) {
//   [0]=> int(10)
//   [1]=> int(50)
//   [2]=> int(99)
// }
```

#### `array()`: array

[](#array-array)

```
Role::array();
// array(3) {
//   [10]=> string(4) "USER"
//   [50]=> string(5) "ADMIN"
//   [99]=> string(4) "ROOT"
// }
```

#### `description()`: ?string

[](#description-string)

```
Role::ROOT->description();
// string(26) "User with full permissions"
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

1255d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ba634eb4d8380454ea20f59230bce9780ef180313f34344bf32af2944b57749?d=identicon)[egor.bulychev](/maintainers/egor.bulychev)

---

Top Contributors

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

---

Tags

helperphp81traitshelperenumenums

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bulychev-enums/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k132.8M873](/packages/barryvdh-laravel-ide-helper)[myclabs/php-enum

PHP Enum implementation

2.7k236.1M692](/packages/myclabs-php-enum)[dasprid/enum

PHP 7.1 enum implementation

382165.7M12](/packages/dasprid-enum)[spatie/enum

PHP Enums

85232.6M76](/packages/spatie-enum)[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

50458.3M110](/packages/marc-mabe-php-enum)[beste/json

A simple JSON helper to decode and encode JSON

4226.8M3](/packages/beste-json)

PHPackages © 2026

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