Description
Simple, extensible and powerful enumeration implementation for Laravel
You can use the following Artisan command to generate a new enum class:
php artisan make:enum UserType
Now, you just need to add the possible values your enum can have as constants.
<?php declare(strict_types=1); namespace App\Enums; use BenSampo\Enum\Enum; final class UserType extends Enum{ const Administrator = 0; const Moderator = 1; const Subscriber = 2; const SuperAdministrator = 3;}
That's it! Note that because the enum values are defined as plain constants, you can simply access them like any other class constant.
UserType::Administrator // Has a value of 0
Recent Courses on Laravel Daily
[NEW] Laravel Boost: Deeper Practical Dive
8 lessons
32 min
Marketing for Developers in 2026
7 lessons
52 min
Roles and Permissions in Laravel 13
14 lessons
57 min