somnambulist/enumeration
Strongly-typed enumeration value objects for PHP and Laravel. Define constants once and get validation rules, Eloquent casting, instance comparison, and attribute access, plus helpers for safe construction. Ideal for modelling fixed sets such as statuses, types, and roles.
enum; this package is the option to weigh only where you're held back by an older runtime or a Laravel version that predates first-class enum validation.Enum-style abstraction is used, then scope the conversion to native backed enums with Rule::enum(). Adoption decisions on this package are really decisions about deferring that migration.Consider it only under a narrow set of conditions:
eloquent/enumeration (the package this forks from) and you need a maintained continuation rather than a rewrite. In that case the fork is a stopgap, not a new commitment.Look elsewhere, or build nothing at all, when:
Rule::enum() and enum casting cover the same ground with zero dependency. This is the default recommendation.For executives. This is a small, MIT-licensed PHP utility that keeps a fixed list of options — statuses, categories, tiers — defined in one place so that screens, validation, and stored data stay consistent. The strategic read is that it solves a real and recurring problem, but the specific package shows no adoption: no stars, no downstream dependents, and it exists only as a continuation of a library that has since been superseded. Recommendation is not to standardize on it. If our stack is on a modern PHP version, the platform now provides this capability natively at no cost and no maintenance burden, and that is where we should point engineering.
For engineering. Treat this as a candidate for a time-boxed evaluation, not a default. The package is a fork of eloquent/enumeration and inherits its design: constant-based enum classes with helpers for keyed/select arrays and a Laravel validation rule. The surface area is small and the license is permissive, so if we need it we can vendor it. The concerns are maturity signals — no community, no dependents, single-maintainer continuation — and the fact that it duplicates functionality now in the language. My ask is a short spike to confirm PHP version constraints and to inventory existing Enum usage; if we are on 8.1+, the outcome should be a migration plan to native backed enums rather than an adoption plan. If we are genuinely blocked on an older runtime, we adopt temporarily, document it as debt with an owner, and set an exit criterion tied to the next runtime upgrade.
How can I help you explore Laravel packages today?