Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Enum Serializer Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Framework fit — decide before anything else. Despite the brief calling this a Laravel package, it is a Symfony bundle. Its only job is to register 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.
  • Wire-format contract for enums. If your API, queue payloads, or webhooks carry enum values, someone has to decide whether an enum serializes as a scalar ("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.
  • Build vs. buy for ~50 lines of glue. The functional surface is small: a normalizer, a denormalizer, and a service registration. This is a genuine build-vs-buy call where "build" is measured in engineer-days, not sprints.
  • Legacy bridge vs. migration investment. If you inherited a Symfony 5.x/6.x codebase using 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.
  • Enum library standardization. Choosing between 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.
  • Use cases it serves: JSON API request/response bodies, Symfony Messenger message payloads, query-string/form binding of enum-like values, and fixtures/data-loaders that need to hydrate enum fields from arrays.

When to Consider This Package

Adopt only when all of the following hold:

  • You are on Symfony, using the Symfony Serializer (not JMS) for a meaningful share of your I/O.
  • You have spatie/enum (v3/v4) as an existing, non-negotiable dependency — typically inherited, not a fresh choice.
  • You are on PHP < 8.1, or you have a large enum surface and no appetite to migrate yet.
  • Your legal/procurement process can clear a NOASSERTION license (GitHub could not detect an OSI license; likely MIT declared in composer.json with no LICENSE file — but "likely" is not a clearance).
  • You accept the supply-chain profile: 0 stars, 0 dependents, single maintainer, last release July 2024, meaning you should plan to vendor or fork it.

Look elsewhere when:

  • You are on Laravel. Framework mismatch; solve with a custom cast or resource mapping in under a day.
  • You are greenfield on PHP 8.1+. Native backed enums plus Symfony's built-in 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.
  • Licensing must be unambiguous. NOASSERTION is a blocker for many enterprise reviews regardless of intent.
  • You need support, SLAs, or a security-response commitment. Zero adoption means you are the only person who will ever find its bugs.
  • You need schema generation. A glue bundle of this size does not give you OpenAPI/JSON-Schema enum definitions; plan for a separate solution either way.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core