outerweb/enum-helpers
Traits to make working with Enums a breeze in Laravel.
1,026
1
| Install | |
|---|---|
composer require outerweb/enum-helpers |
|
| Latest Version: | v2.0.1 |
| PHP: | ^8.4 |
| Laravel: | 11 · 12 · 13 |
| Older releases: | 10 |
| License: | MIT |
| Last Updated: | Apr 20, 2026 |
| Links: | GitHub · Packagist |
Maintainer: outerweb.be

Enum helpers
This package provides a set of traits you can use to extend the functionality of your enums in Laravel.
Table of Contents
Installation
You can install the package via composer:
composer require outerweb/enum-helpers
Usage
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
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
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
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
Related Packages
outerweb/filament-translatable-fields
Filament integration for spatie/laravel-translatable
132,684
36
outerweb/filament-image-library
Filament integration for the outerweb/image-library package
13,566
24
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v2.0.1 | ^8.4 | ^11.0|| | MIT | |
| v2.0.0 | ^8.4 | ^11.0|| | MIT | |
| v1.2.0 | ^8.1 | ^10.0| | MIT | |
| v1.0.1 | ^8.1 | ^10.0| | MIT | |
| v1.0.0 | ^8.1 | ^10.0 | MIT |