mrgoodbytes8667/enum-serializer-bundle
A Symfony bundle that adds serialization support for PHP enums, making it easy to convert backed enum cases to and from scalar values across APIs, Doctrine and config, with lightweight integration and minimal setup.
spatie/enum normalizers/denormalizers with Symfony's Serializer component. It has no relevance to a Laravel service (Laravel would use casts or JsonResource mapping instead). First decision it enables: does this even enter our dependency review? For a Laravel roadmap, the answer is no."status": "active") or an object. This package encodes one answer for Symfony + spatie/enum stacks and makes that contract explicit and testable rather than emergent from ad-hoc controller code.spatie/enum across domain models, this is a stopgap that unblocks API work without a framework-wide refactor. That is a roadmap sequencing decision: ship the feature now, migrate enums later.spatie/enum value objects and native PHP 8.1 backed enums is an architecture decision with downstream consequences for validation, OpenAPI schema generation, DB persistence, and form binding. This package only exists in the world where you chose spatie/enum.Adopt only when all of the following hold:
spatie/enum (v3/v4) as an existing, non-negotiable dependency — typically inherited, not a fresh choice.composer.json with no LICENSE file — but "likely" is not a clearance).Look elsewhere when:
BackedEnumNormalizer (6.3+) cover the common case with zero third-party code. Pure/unit enums still need a small custom normalizer, but that is your code, not a dependency.To executives — one line: This is a small, single-purpose glue library that makes PHP enum objects serialize cleanly in a Symfony API. It is not a strategic component, and I recommend we do not take it as a dependency; the same behavior is roughly one to two engineer-days of in-house code, which we can own, license-check, and patch without a third party.
To engineering — the substance: It solves a real, boring problem (enum hydration in Symfony Serializer) for stacks locked into spatie/enum. But it is a 0-star, 0-dependent package with an unclear license and no maintenance signal beyond a single 2024 release. The equivalent is a Normalizer/Denormalizer pair plus a service definition. If we are already on PHP 8.1+, migrating to native enums removes the need entirely and drops a dependency; if we are not, a vendored fork with our own tests is cheaper to own than a dependency we cannot get support for. Either way, the enum wire format is the decision that matters — this package is just one implementation of it.
Recommended next step: a one-day spike to write the in-house normalizer and a two-day estimate for native-enum migration on the highest-traffic models; revisit this package only if the migration is deferred past the next release.
How can I help you explore Laravel packages today?