bensondevs/supercharged-enums
Supercharged Enums adds helpful, expressive methods to PHP 8.1+ enums so you can do more with less code in your Laravel apps. It keeps enum logic clean and readable, with a simple API for common tasks like labels, comparisons, and validation.
Install the package with Composer; Laravel package discovery registers SuperchargedEnumsServiceProvider automatically, so no manual provider registration is needed.
If you want generated enums to include EnumExtension out of the box, publish the package stubs before creating your first enum:
php artisan vendor:publish --tag=supercharged-enums-stubs
Then generate a backed enum:
php artisan make:enum Status --string
Open the generated file first and confirm it imports and uses EnumExtension. That is the quickest way to verify the package is wired correctly.
If you use Laravel Boost or AI-assisted development, look at resources/boost/ next. The package ships a supercharged-enums-development skill and guidelines. Run:
php artisan boost:install
# or, for an existing Boost setup:
php artisan boost:update --discover
A good first use case is a Status enum used for model state, form options, and validation rules.
Generate enums through Artisan. Prefer php artisan make:enum Status --string or --int over hand-writing files so the package stub and EnumExtension wiring stay consistent.
Use backed enums at boundaries. String-backed enums are convenient for database values, API payloads, and logs. Int-backed enums are better for compact storage. Pick one and avoid changing the backing type after data exists.
Centralize enum behavior with EnumExtension. Keep labels, colors, options, and small presentation helpers on the enum itself, then reuse them in validation, forms, and API resources:
Rule::enum(Status::class);
Status::options();
Status::from($value)->label();
Customize the stub once, then regenerate. Publish the stubs, edit enum.backed.stub to match team conventions, and commit the published stub if you want consistent output across the team. Regenerate rather than hand-editing generated files.
Use the Boost skill as an agent contract. After boost:update --discover, AI agents can read the package guidelines and follow the expected enum structure. Pair this with make:enum so agents generate enums through the same path as human developers.
Keep enum logic small. EnumExtension is best for presentation and lookup helpers. Avoid putting heavy domain workflows or database access inside enums; move those to services or actions.
enum.backed.stub is opt-in. If you run make:enum first, you may get enums without EnumExtension and need to regenerate or edit them.make:enum is unavailable, run composer dump-autoload and php artisan package:discover, then clear caches with php artisan optimize:clear.php artisan boost:update --discover; boost:install only covers the initial setup path.--tag=supercharged-enums-stubs and customize the copy in your application.make:enum command or custom enum base class, adjust the published stub and confirm the package command is the one being resolved.EnumExtension is missing after generation, inspect the published stub and confirm the enum imports the correct trait namespace.boost:update --discover if you use Boost.How can I help you explore Laravel packages today?