PHPackages                             anteris-dev/enum-descriptions - 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. anteris-dev/enum-descriptions

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

anteris-dev/enum-descriptions
=============================

Adds description attributes for enums.

v0.1.0(4y ago)018MITPHPPHP ^8.1

Since Jan 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Anteris-Dev/enum-descriptions)[ Packagist](https://packagist.org/packages/anteris-dev/enum-descriptions)[ RSS](/packages/anteris-dev-enum-descriptions/feed)WikiDiscussions master Synced 1mo ago

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

Enum Descriptions
=================

[](#enum-descriptions)

This package adds descriptions to PHP Enums by utilizing a `Description` attribute.

To Install
----------

[](#to-install)

Use composer to install this package by running the following command:

`composer require anteris-dev/enum-descriptions`

Getting Started
---------------

[](#getting-started)

You may specify a description for a case by using the `Description` attribute as shown below. If no description is set on the case, its name will be split by uppercase letters, joined with spaces, and then the first word will be capitalized (e.g., `someValue` becomes `Some value`).

```
use AnterisDev\EnumDescriptions\Description;

enum Animal
{
    #[Description('A cute dog.')]
    case Dog;

    #[Description('A fuzzy cat.')]
    case Cat;
}
```

Retrieving Descriptions
-----------------------

[](#retrieving-descriptions)

There are several helpers that will assist you with retrieving descriptions. First are the global functions.

### Global Functions

[](#global-functions)

```
// Accepts an enum class name and returns an array. Enum values are represented in the array keys
// and enum descriptions are represented as those key values.
enum_descriptions(Animal::class);

// Returns the string description for the specific enum passed.
enum_description(Animal::Dog);
```

### Traits

[](#traits)

You may also add the `HasDescriptions` trait to your enum to expose some helpful functions there.

```
use AnterisDev\EnumDescriptions\HasDescriptions;

enum Animal
{
    use HasDescriptions;
}

// Returns an array. Enum values are represented in the array keys and enum
// descriptions are represented as those key values.
Animal::descriptions();

// Returns the description for the specific value specified.
Animal::Dog->description();
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

1568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dca3c3ac71024f7878526a0fe0a384fbf198ed711fe7e7bb34177a1dbc849f6?d=identicon)[golthem](/maintainers/golthem)

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/anteris-dev-enum-descriptions/health.svg)

```
[![Health](https://phpackages.com/badges/anteris-dev-enum-descriptions/health.svg)](https://phpackages.com/packages/anteris-dev-enum-descriptions)
```

###  Alternatives

[shivella/laravel-bitly

Laravel package for generating bitly url

75789.0k1](/packages/shivella-laravel-bitly)[pablorsk/argentina-data-generator

Argentina data generator for CUIT and CBU numbers

1323.7k](/packages/pablorsk-argentina-data-generator)

PHPackages © 2026

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