PHPackages                             outerweb/enum-helpers - 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. outerweb/enum-helpers

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

outerweb/enum-helpers
=====================

Traits to make working with Enums a breeze in Laravel.

v2.0.1(2mo ago)1581[4 PRs](https://github.com/outer-web/enum-helpers/pulls)1MITPHPPHP ^8.4CI passing

Since Dec 25Pushed 2mo agoCompare

[ Source](https://github.com/outer-web/enum-helpers)[ Packagist](https://packagist.org/packages/outerweb/enum-helpers)[ Docs](https://github.com/outer-web/enum-helpers)[ GitHub Sponsors](https://github.com/Outerweb)[ RSS](/packages/outerweb-enum-helpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (26)Versions (9)Used By (1)

[![Enum helpers](./docs/images/github-banner.png)](./docs/images/github-banner.png)

Enum helpers
============

[](#enum-helpers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b0bb0959dcc90cbffa0d788d02e982eaba9fc12bba8f737bb3c1c7c1d78ebb85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f757465727765622f656e756d2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/enum-helpers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b09411eb4aba2014f78e6e433dd7b69e4c931df1d13fcf444dbb5c9331263a88/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f757465727765622f656e756d2d68656c706572732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/outer-web/enum-helpers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6bda7e44ae2309dd127aa336092a74e3a658a8bb06ca1ceb6cd9bf14bcf32d31/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f757465727765622f656e756d2d68656c706572732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/outer-web/enum-helpers/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/475155c96fd26dc6b30f4e892142237c3eae475925db0ec55d6aae2cb10deca4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f757465727765622f656e756d2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/enum-helpers)

This package provides a set of traits you can use to extend the functionality of your enums in Laravel.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require outerweb/enum-helpers
```

Usage
-----

[](#usage)

### Collection support

[](#collection-support)

Add the following trait to your backed enum to get collection support:

```
use Outerweb\EnumHelpers\HasCollectionSupport;

enum MyEnum: string
{
    use HasCollectionSupport;

    case Foo = 'foo';
    case Bar = 'bar';

    public function getLabel(): string
    {
        return match ($this) {
            self::Foo => 'Foo label',
            self::Bar => 'Bar label',
        };
    }
}
```

This allows you to collect enum cases easily into a Laravel collection:

```
$collection = MyEnum::collect(); // Collection{'foo' => MyEnum::Foo, 'bar' => MyEnum::Bar}
```

### Getting a collection of values

[](#getting-a-collection-of-values)

You can get a collection of enum values using the `collect('value')` method:

```
$values = MyEnum::collect('value'); // Collection{'foo' => 'foo', 'bar' => 'bar'}
```

### Getting a collection of return values of a function

[](#getting-a-collection-of-return-values-of-a-function)

You can get a collection of return values of a function by passing the function name to the `collect()` method:

```
$mapped = MyEnum::collect('getLabel'); // Collection{'foo' => 'Foo label', 'bar' => 'Bar label'}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance87

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~203 days

Total

5

Last Release

62d ago

Major Versions

v1.2.0 → v2.0.02025-10-07

PHP version history (2 changes)v1.0.0PHP ^8.1

v2.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5a072b1191f02ac21a84af067a579b6f3323da7e45197369a7540f98c152407?d=identicon)[outerweb.be](/maintainers/outerweb.be)

---

Top Contributors

[![SimonBroekaert](https://avatars.githubusercontent.com/u/35606498?v=4)](https://github.com/SimonBroekaert "SimonBroekaert (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelOuterwebenum-helpers

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/outerweb-enum-helpers/health.svg)

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

###  Alternatives

[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[tonysm/importmap-laravel

Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling.

148399.8k1](/packages/tonysm-importmap-laravel)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[outerweb/settings

Application wide settings stored in your database

4899.2k5](/packages/outerweb-settings)

PHPackages © 2026

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