A new package for Laravel + PHP Enums
Tom Schlick • January 29, 2023
laravel php open-sourcePHP 8.1 introduced an awesome feature for first party Enum types. No longer do we have to construct quasi enums out of PHP constants and custom validation logic.
As great as they are though, we can always make the integration of them more seamless into Laravel. With that, I'm happy to announce a new Laravel Enums package for Laravel.
It allows you to easily create enums with php artisan make:enum and enables you to specify if it's a --int
based enum or --string
. Simply add --test
to create a corresponding PHPUnit unit test class or --pest
if you're utilizing PestPHP.
To install it, simply run composer install returnearly/laravel-enums
and composer will handle the rest!