cerbero/enum
A powerful enum implementation for Laravel that turns class constants into rich, type-safe enum objects. It adds validation rules, localization, Eloquent casting, comparisons, and Blade helpers while keeping enums simple and extensible.
App\Enums\BaseEnum trait with toArray(), labels(), forSelect(), etc. This package is that trait, already written, tested, and zero-dependency (MIT). Default to adopting it instead of building a homegrown helper class.forSelect), localization-ready labels via attributes, Eloquent casts for DB persistence, request validation rules, toJson/toArray serialization for APIs, flag/bitmask combinations for permissions or settings, and case comparison (is(), in()) to replace brittle === checks scattered through services.Adopt when:
Look elsewhere or defer when:
Rule::enum may cover part of the need).For executives: This is a free, MIT-licensed utility that removes repetitive code when using PHP's built-in enum feature. It reduces developer time on a common class of features (statuses, categories, permissions) and standardizes how those values are displayed, validated, and stored. Cost is near zero; risk is low because it has no runtime dependencies and can be removed or forked with minimal effort if needed.
For engineering: It layers practical helpers on native enums—labels via attributes, forSelect/toArray/toJson for output, Eloquent casts and validation rules for persistence and input, and is()/in() for comparisons/flags. Zero dependencies keeps the install surface clean; small API means low learning cost. Recommendation: pilot on one or two enum-heavy features first, capture how much helper code it deletes, then decide whether to adopt it as the team's standard. Flag single-maintainer/bus-factor risk and set a simple rule: keep our enum definitions portable (no framework-specific magic in domain code) so the package stays a convenience, not a lock-in.
How can I help you explore Laravel packages today?