azimkordpour/power-enum
Power Enum enhances native PHP enums for Laravel with convenient helpers for labels, validation rules, Eloquent casts, and value comparisons, making status and type fields safer, more consistent, and easier to use across your application.
App\Support\Enum trait, or adopt a more mature alternative." At 41 stars, 0 dependents, and a single 2025-04-04 release, vendoring/forking is the defensible PM decision; taking a hard Composer dependency on it is not.<select> options for forms, whitelisting values in request validation, serializing enum cases to API payloads, mapping machine values to human labels, and seeding test data with random cases.Consider it when:
options(), toArray(), values(), label maps — repeated across many enum classes.Look elsewhere when:
spatie/laravel-model-states or a dedicated FSM library.archtechx/enums covers a very similar trait-based surface with far more adoption; BenSampo/laravel-enum covers the pre-8.1 generation; Laravel itself ships an Enum validation rule now.To executives (one paragraph): This is a small, MIT-licensed utility that trims repetitive code around PHP enums — the mechanism we use to keep statuses, roles, and tiers consistent across the product. Cost is effectively zero and it is not a strategic dependency; the recommendation is to pilot it in one module or simply copy the trait into our codebase rather than adopt it as a platform component. The downside risk of the package's low adoption (41 stars, no dependents, single maintainer) is neutralized by the permissive license and the fact that we can own the ~40 lines ourselves. No budget, no procurement, no roadmap impact.
To engineering: Drop-in trait for enum classes; adds options/values/label helpers and reduces duplicated array_column(self::cases(), 'value') code across the codebase. PHP 8.1+ required. Recommend a one-sprint spike: vendor the trait under App\Support\Concerns, add our own unit tests, and compare against archtechx/enums before committing. Do not put it on a critical path without a fork we control. Success criteria: fewer than X duplicated enum helper methods remaining after adoption, and zero production incidents attributable to the trait.
How can I help you explore Laravel packages today?