yokai/enum-bundle
Yokai Enum Bundle adds practical PHP 8.1 enum support: register enum types, expose choices in forms, validate values, and convert between enums, scalars, and database values through configurable services.
Consider it only when all of the following hold:
enum is unavailable.yokai/enum library) — e.g., injecting enum sets into services or validating against them in forms.Look elsewhere when:
enum_exists(), and match cover this completely, with zero dependency and full static analysis support. Laravel's casts and validation Rule::enum() handle persistence and request validation.spatie/laravel-enum or archtechx/enums instead; both have materially larger ecosystems.For executives (one paragraph): A team member has surfaced yokai/enum-bundle, a small open-source library for defining enumerated value lists in Symfony applications. Our recommendation is do not adopt it. It solves a problem PHP itself solved in version 8.1, it has negligible community traction (12 stars, no downstream dependents, one maintainer), and it does not integrate with our Laravel stack. Adopting it would add a maintenance liability in exchange for no product capability. The only scenario worth revisiting is a legacy PHP 7.x Symfony service where it could save a few days of refactoring — and even there, the better investment is accelerating that service's PHP upgrade. Cost of adoption: near zero in license fees, non-trivial in long-term ownership. Cost of not adopting: none.
For engineering leads: Treat this as a pattern reference, not a dependency. The valuable output is the discipline of one canonical, typed enum per domain concept with a single source of truth for labels and validation — which we get for free from native PHP 8.1+ enums and Laravel's Rule::enum() plus attribute casting. If a legacy Symfony service on PHP < 8.1 genuinely needs container-registered enum sets, scope it to that service, pin the version, and record it in the dependency register with an explicit removal date tied to the PHP upgrade. Do not let it into shared libraries or anything customer-facing. If the underlying need is richer — Eloquent casting, query scopes, OpenAPI schemas — the correct evaluation set is spatie/laravel-enum or archtechx/enums, both of which carry real ecosystem weight and should be assessed against a build-in-house baseline.
How can I help you explore Laravel packages today?