PHPackages                             legecha/enumpty - 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. legecha/enumpty

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

legecha/enumpty
===============

Find yourself creating methods like label(), description() or icon() on your enums? This very simple package takes the legwork out of doing so for you, and gives you the same functionality without implementing the methods.

v1.1.0(2y ago)0288MITPHPPHP &gt;=8.1

Since Jan 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/legecha/enumpty)[ Packagist](https://packagist.org/packages/legecha/enumpty)[ RSS](/packages/legecha-enumpty/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

enumpty
=======

[](#enumpty)

Describe your enums!

Find yourself creating methods like `label()`, `description()` or `icon()` on your enums? This very simple package takes the legwork out of doing so for you, and gives you the same functionality without implementing the methods.

Instead, just describe your cases with attributes!

Example
-------

[](#example)

Simply use the `Describable` trait and describe your cases with the `DescribeEnum` attribute using named parameters.

Methods on the enum values are now available, as well as static `*Cases` methods on the enum type.

```
use Legecha\Enumpty\Attributes\DescribeEnum;
use Legecha\Enumpty\Describable;

enum MyEnum
{
    use Describable;

    #[DescribeEnum(label: 'My First Case', description: "My first description")]
    case First;
    #[DescribeEnum(description: "My second description", label: 'My 2nd Case'])
    case Second;
    case Third;
    #[DescribeEnum(label: 'My Fourth Case')]
    case Fourth;
}

$enum = MyEnum::First;
$enum->label(); // string(13) "My First Case"
$enum->description(); // string(20) "My first description"

$enum = MyEnum::Third;
$enum->description(); // NULL

MyEnum::labelCases();
/*
array(4) {
  ["MyEnum::First"]=>
  string(13) "My First Case"
  ["MyEnum::Second"]=>
  string(11) "My 2nd Case"
  ["MyEnum::Third"]=>
  NULL
  ["MyEnum::Fourth"]=>
  string(14) "My Fourth Case"
}
*/
MyEnum::descriptionCases();
/*
array(4) {
  ["MyEnum::First"]=>
  string(20) "My first description"
  ["MyEnum::Second"]=>
  string(21) "My second description"
  ["MyEnum::Third"]=>
  NULL
  ["MyEnum::Fourth"]=>
  NULL
}
*/
```

But wait, there's more!
-----------------------

[](#but-wait-theres-more)

There is also the `Names` trait, which provides a `name()` method to get a "pretty" version of your enum case's name, and a `names()` static method to retrieve them all for a specific enum. No attributes required.

```
use Legecha\Enumpty\Names;

enum MyEnum
{
    use Names;

    case MyFirstCase;
    case Second;
    case HereIsTheThird;
    case DontForgetTheFourth;
}

$enum = MyEnum::MyFirstCase;
$enum->name(); // string(13) "My First Case"
MyEnum::HereIsTheThird->name(); // string (15) "Here Is The Third"

MyEnum::names();
/*
array(4) {
  ["MyEnum::MyFirstCase"]=>
  string(13) "My First Case"
  ["MyEnum::Second"]=>
  string(6) "Second"
  ["MyEnum::HereIsTheThird"]=>
  string(15) "Here Is The Third"
  ["MyEnum::DontForGetTheFourth"]=>
  string(23) "Dont Forget The Fourth"
}
*/
```

Install
-------

[](#install)

`composer require legecha/enumpty`

Issues and Contributing
-----------------------

[](#issues-and-contributing)

This is a very simple package, but pull requests are more than welcome. Please include a test and clean up the code before doing do.

```
composer test
composer fix

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

2

Last Release

875d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/065312ec1bb5f312f0c86f99d8f96896d3a5efaad0632a8bfcd74466d25a24e7?d=identicon)[legecha](/maintainers/legecha)

---

Top Contributors

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

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/legecha-enumpty/health.svg)

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

###  Alternatives

[2amigos/yii2-grid-view-library

GridView Widget Extensions for Yii2.

56150.2k12](/packages/2amigos-yii2-grid-view-library)[kjdev/brotli

A compression/decompression with Brotli

1991.6k](/packages/kjdev-brotli)[shipmonk/phpstan-ignore-inliner

Inline your PHPStan error ignores into the source files via @phpstan-ignore comments.

1514.1k](/packages/shipmonk-phpstan-ignore-inliner)

PHPackages © 2026

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