PHPackages                             annotation/enumeration - 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. annotation/enumeration

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

annotation/enumeration
======================

Get enum attributes using PHP 8 annotations.

v1.0.0(1y ago)09.6kMITPHPPHP ^8.0

Since Jan 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dependencies-packagist/annotation-enumeration)[ Packagist](https://packagist.org/packages/annotation/enumeration)[ Docs](https://github.com/dependencies-packagist/annotation-enumeration)[ RSS](/packages/annotation-enumeration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Annotation Enumeration
======================

[](#annotation-enumeration)

Get enum attributes using PHP 8 annotations.

[![GitHub Tag](https://camo.githubusercontent.com/4ad3f3e91610522f6736f62f3d9bd02b602e58078f4e2bb7a8d1fd5552b1006b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f646570656e64656e636965732d7061636b61676973742f616e6e6f746174696f6e2d656e756d65726174696f6e)](https://github.com/dependencies-packagist/annotation-enumeration/tags)[![Total Downloads](https://camo.githubusercontent.com/e7f16ff1b81c249bfd5e562834cd15f6c4dd1d21d4b5693cdffb507a4dc82f8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e6e6f746174696f6e2f656e756d65726174696f6e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/annotation/enumeration)[![Packagist Version](https://camo.githubusercontent.com/5940eb378727c992067fe6e6fc6a62f7c155937ae2c7de0258b16ff87710ac2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e6e6f746174696f6e2f656e756d65726174696f6e)](https://packagist.org/packages/annotation/enumeration)[![Packagist PHP Version Support](https://camo.githubusercontent.com/575c124d3356baf8fc574bfe7e418368bf78bb55ccf8033efcc05a9c1aab0292/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616e6e6f746174696f6e2f656e756d65726174696f6e)](https://github.com/dependencies-packagist/annotation-enumeration)[![Packagist License](https://camo.githubusercontent.com/3870d6dbe2c93f2eee31b87e427cd0c0867476866ce73368eb0d9b5cc85df6e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646570656e64656e636965732d7061636b61676973742f616e6e6f746174696f6e2d656e756d65726174696f6e)](https://github.com/dependencies-packagist/annotation-enumeration)

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

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require annotation/enumeration
```

```
use Annotation\Enumeration\Attributes\Enumeration;

class User
{
    use HasEnumeration;

    #[Enumeration([
        'WAIT' => '待审核',
        'PASSED' => '成功',
        'FAILED' => '失败',
    ])]
    public function status()
    {
        //return $this->getAttributeEnumeration('status');
    }

}
```

```
$user = new User();

$user->status();

$user->getAttributeEnumerations();
//[
//    'status' => [
//        'wait' => '待审核',
//        'passed' => '成功',
//        'failed' => '失败',
//    ],
//];

$user->getAttributeEnumeration('status', 'WAIT', '--');
// 待审核

$user->getAttributeEnumeration('status', '', '--');
// --

$user->getEnumeration($user->getAttributeEnumeration('status'), 'PASSED', '--');
// 成功
```

License
-------

[](#license)

Nacosvel Contracts is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance41

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

494d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/jundayw)

---

Top Contributors

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

---

Tags

laravelenumerationattributesannotation

### Embed Badge

![Health badge](/badges/annotation-enumeration/health.svg)

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

###  Alternatives

[cerbero/laravel-enum

Laravel package to supercharge enum functionalities.

18989.6k](/packages/cerbero-laravel-enum)[emreyarligan/enum-concern

A PHP package for effortless Enumeration handling with Laravel Collections 📦 ✨

21156.3k1](/packages/emreyarligan-enum-concern)[vanilo/properties

Vanilo Properties (Attributes) Module

11105.2k2](/packages/vanilo-properties)

PHPackages © 2026

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