PHPackages                             commitglobal/enum-utils - 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. commitglobal/enum-utils

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

commitglobal/enum-utils
=======================

Collection of PHP utilities for working with enums

1.1.0(3mo ago)01.1kMPL-2.0PHPPHP ^8.2CI passing

Since Jul 31Pushed 3mo agoCompare

[ Source](https://github.com/commitglobal/php-enum-utils)[ Packagist](https://packagist.org/packages/commitglobal/enum-utils)[ RSS](/packages/commitglobal-enum-utils/feed)WikiDiscussions main Synced yesterday

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

PHP Enum Utils
==============

[](#php-enum-utils)

[![GitHub contributors](https://camo.githubusercontent.com/16d874eace63548533cad3d105822cb291c0355bae2d987cbe29ab3965d75e4d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f636f6d6d6974676c6f62616c2f7068702d656e756d2d7574696c732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/commitglobal/php-enum-utils/graphs/contributors)[![GitHub last commit](https://camo.githubusercontent.com/48e5d5e44e1ead11c75a917a50c5ae567c867a012a50a9ee6ef9b297591681e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f636f6d6d6974676c6f62616c2f7068702d656e756d2d7574696c732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/commitglobal/php-enum-utils/commits/main)[![License: MPL 2.0](https://camo.githubusercontent.com/dc880604632bfdd45ff30adf27c484f5ba239973133e67420f00b83800ed7030/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d504c253230322e302d627269676874677265656e2e7376673f7374796c653d666f722d7468652d6261646765)](https://opensource.org/licenses/MPL-2.0)

Collection of utilities for working with enums.

[Contributing](#contributing) | [Install](#install) | [Usage](#usage) | [Feedback](#feedback) | [License](#license) | [About Code for Romania](#about-code-for-romania)

Contributing
------------

[](#contributing)

This project is built by amazing volunteers and you can be one of them! Here's a list of ways in [which you can contribute to this project](https://github.com/code4romania/.github/blob/main/CONTRIBUTING.md). If you want to make any change to this repository, please **make a fork first**.

Help us out by testing this project in the \[staging environment\]\[link-staging\]. If you see something that doesn't quite work the way you expect it to, open an Issue. Make sure to describe what you *expect to happen* and *what is actually happening* in detail.

If you would like to suggest new functionality, open an Issue and mark it as a **\[Feature request\]**. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.

Install
-------

[](#install)

```
composer require commitglobal/enum-utils
```

Usage
-----

[](#usage)

### Arrayable

[](#arrayable)

Important

For `Arrayable::options()`, your enum must implement a `getLabel()` method.

MethodDescription`names()`Returns an array of enum case names.`values()`Returns an array of enum case values.`options()`Returns an associative array mapping values to labels.```
enum Status: string
{
    use CommitGlobal\Enums\Concerns\Arrayable;

    case ACTIVE = 'active';
    case INACTIVE = 'inactive';

    public function getLabel(): string
    {
        return match($this) {
            self::ACTIVE => 'Account is active',
            self::INACTIVE => 'Account is inactive',
        };
    }
}
```

```
Status::names();   // ['ACTIVE', 'INACTIVE']
Status::values();  // ['active', 'inactive']
Status::options(); // ['active' => 'Account is active', 'inactive' => 'Account is inactive']
```

### Comparable

[](#comparable)

MethodDescription`is($enum)`Check if this enum matches the given enum instance or value.`isNot($enum)`Check if this enum does't match the given enum instance or value.#### Example

[](#example)

```
enum Status: string
{
    use CommitGlobal\Enums\Concerns\Comparable;

    case ACTIVE = 'active';
    case INACTIVE = 'inactive';
}
```

```
$status = Status::ACTIVE;

$status->is(Status::ACTIVE);   // true
$status->is('active');         // true
$status->is(Status::INACTIVE); // false
$status->isNot('inactive');    // true
```

Feedback
--------

[](#feedback)

- Request a new feature on GitHub.
- Vote for popular feature requests.
- File a bug in GitHub Issues.
- Email us with other feedback

License
-------

[](#license)

This project is licensed under the MPL 2.0 License - see the [LICENSE](LICENSE) file for details

About Code for Romania
----------------------

[](#about-code-for-romania)

Started in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community of around 2.000 volunteers (developers, ux/ui, communications, data scientists, graphic designers, devops, it security and more) who work pro-bono for developing digital solutions to solve social problems. #techforsocialgood. If you want to learn more details about our projects [visit our site](https://www.code4.ro/en/) or if you want to talk to one of our staff members, please e-mail us at .

Last, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that is widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want to support us, [you can do it here](https://code4.ro/en/donate/).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance82

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

93d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6dc897d66ecd0478a6c38f2a4a28108f5767175849c2183ff81e28f9ea82d5fa?d=identicon)[andreiio](/maintainers/andreiio)

---

Top Contributors

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

---

Tags

php

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/commitglobal-enum-utils/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M281](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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