frostiede/enum-bundle
A Symfony bundle that simplifies working with PHP enums, providing integration helpers and utilities to use enum types more cleanly across your application. Ideal for projects adopting PHP 8.1+ enums with Symfony.
Architecture fit — negative at the bundle layer, conditional at the core layer. The EnumBundle naming is Symfony convention: bundles are registered through a kernel, shipped with Flex recipes, and wired via a DependencyInjection/*Extension.php config tree. Laravel has no equivalent abstraction, so the bundle half of this package is dead weight in our stack — at best inert, at worst an autoload or boot-time failure. The underlying enum implementation, if it is separable as a plain Composer package, is framework-agnostic PHP and could in principle be consumed in Laravel. That is an unverified assumption and the single most important thing to check.
The core value proposition is largely obsolete. PHP 8.1 shipped native backed enums, and Laravel now covers the adjacent ground natively: enum casting on Eloquent attributes, Rule::enum() validation, ->enum() migration columns, and enum-aware factories. A userland enum library only earns its place if it offers something materially beyond that — instance maps, ordering/ordinal semantics, label lookup, coercion helpers. The package description claims validation, serialization, and transformation helpers, and those are real, but they are also the ~50–100 lines we would otherwise write ourselves. This is a build-vs-borrow decision on a micro-utility, not a platform adoption.
Integration feasibility — low-friction on paper, high-friction in practice. Two blockers are likely and both are cheap to test:
symfony/* version constraints that collide with the symfony/* transitives Laravel already pulls in (console, http-foundation, routing, finder). Expect composer require to fail against our locked set before any code is written.Enum base. Native enum types cannot extend classes and cannot be instantiated. If that is the design, adopting this package means committing to a class-based value-object pattern that is architecturally incompatible with native enums — and because you cannot incrementally convert a class hierarchy into native enums, that is a one-way door.Technical risk — high. Zero stars, zero dependents, zero downstream usage, and a score of 0. There is no evidence any production system runs this, no issue corpus to learn from, no ecosystem pressure to catch regressions, and a bus factor of one. For anything that touches persistence or serialization boundaries — which is exactly where enums live — that risk profile is unacceptable without a deliberate fork-and-own decision. Absent the checks below, the correct default posture is "pattern to copy," not "package to depend on."
Key questions to resolve before a line of code:
symfony/* constraints, and do they resolve against our current Laravel version and PHP floor/ceiling?Rule::enum do not? Produce a line-by-line gap list.TPM framing. Treat this as a dependency-governance decision with a written decision record, not as a feature request. The deliverable is a go/no-go with a named owner, an expiry date, and a documented exit ramp — not an integration ticket.
Stack fit. Negative at the bundle layer; neutral-to-conditional at the core layer. My recommendation is to not adopt the bundle and to adopt the core library only if question 4 surfaces a concrete capability we actually need. The default path — native PHP 8.1 enums, Eloquent enum casting, Rule::enum, and one small internal trait for values()/labels()/options() — replaces the library's entire surface area with roughly 50 lines we own outright, with zero dependency risk and full static-analysis and IDE support.
Migration path. If we proceed at all, run it as a timeboxed spike on a scratch branch, never on main:
composer require against the locked dependency set and capture conflict output verbatim — this output is the artifact that ends the discussion cheaply if it fails.OrderStatus), persist it through Eloquent, validate it via a FormRequest, serialize it through a queued job, and render it in an admin select.If we adopt, wrap it behind an internal contract — a HasLabels / HasValues interface in our namespace — so no call site references the vendor namespace. That abstraction is the exit ramp and costs one extra hour.
Compatibility. Test on the lowest and highest PHP versions we support and on the current Laravel major plus the prior one. The symfony/* transitive constraints are where I expect the spike to fail, and that failure is itself a valid, cheap outcome worth publishing to the team.
Sequencing (with gates):
Keep the whole evaluation inside one sprint. This is a small decision that should not acquire a steering committee.
Maintenance. Adoption means we own this code in all but name. With no active upstream community, Laravel and Symfony major upgrades become our incident to absorb, and a symfony/* bump anywhere else in the tree can break installs without warning. Budget ongoing ownership cost, not a one-time integration cost — and note that the ownership burden is disproportionate to the code's size because it sits in the domain layer where every service touches it.
Support. No vendor, no maintainer SLA, no forum, no Stack Overflow corpus. Internal expertise is the only support channel. That is defensible for a small utility with a named owner; it is not defensible for something every entity and API resource depends on.
Scaling. Runtime cost is negligible — enum resolution is CPU-trivial and will never appear in a profile. The real scaling concern is surface area: the more places an enum instance is persisted, cached, or queued, the more a change to the class shape becomes a breaking change. Enforce a standing rule that only scalar backed values cross storage, cache, and queue boundaries — never enum instances. That rule is good hygiene regardless of which path we choose, and it is the single highest-leverage mitigation available.
Failure modes to watch:
dev-master.composer dump-autoload --optimize if bundle classes assume Symfony's kernel registration.Ramp-up. Technically low: an afternoon of source reading for a mid-level PHP developer. The cost that matters is organizational. Every new hire must learn a bespoke enum pattern that no longer appears in the wider PHP ecosystem, and every reviewer must police its boundaries. That tax compounds indefinitely against a native-enum alternative that the language itself maintains and every PHP developer already knows.
TPM recommendation. Decline the bundle. Approve a one-day spike to confirm the core library offers nothing we cannot write in an afternoon, then standardize on native PHP 8.1 enums with a small internally owned trait, captured as an ADR with a named owner and a revisit trigger (e.g. "revisit if three teams independently reimplement label maps"). This converts an unbounded dependency risk into a bounded, owned, 50-line asset — and gives stakeholders a cost of near zero with the maintenance exposure capped and documented.
How can I help you explore Laravel packages today?