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

Jms Serializer Uuid Laravel Package

mhujer/jms-serializer-uuid

Adds JMS Serializer support for ramsey/uuid: serialize UUID objects as strings and deserialize string values back into UUID instances, so UUID fields work cleanly in your JMS Serializer mappings.

Deep Wiki
Context7

Product Decisions This Supports

  • API payload shape (build vs. buy). This package answers a narrow but product-visible question: when a domain object holds a Ramsey\Uuid value, what does the JSON/XML on the wire look like? With the handler registered, the API emits "id": "8f1c..." instead of leaking object internals or a nested representation. That makes it a lever for contract stability — clients, SDKs, and partner integrations can rely on UUIDs as flat strings across every endpoint.
  • DTO/Resource serialization strategy. If a product surfaces UUIDs through JMS Serializer-driven DTOs (common in Symfony-flavored services, and in some Laravel projects using JMS as an alternative to API Resources or Fractal), this decides whether UUIDs serialize "for free" or require hand-written per-DTO listeners. That is the difference between one global registration and N custom handlers — a maintenance cost that compounds with every new endpoint.
  • Roadmap trigger to watch. Last release was August 2016 at 29 stars. That is a signal for the platform roadmap: any plan to upgrade PHP (7 → 8.x), Ramsey UUID (v3 → v4), or JMS Serializer (2.x → 3.x) needs a compatibility spike against this dependency. It becomes a "fork-or-vendor" line item, not a feature line item.
  • Use cases it directly unlocks. Exposing UUID primary keys, correlation/trace IDs, and external identifier mappings through JMS Serializer JSON and XML; multi-format exports where the same UUID must render identically everywhere; versioned API contracts where the UUID is the stable identifier.

When to Consider This Package

Consider it when all of the following hold:

  • The service already uses JMS Serializer — not Laravel's Eloquent API Resources, Fractal, or symfony/serializer. JMS is the prerequisite, and it is not the Laravel default.
  • Domain models/DTOs hold Ramsey\Uuid\Uuid / UuidInterface values.
  • You need UUIDs as plain strings in serialized output and reconstructed as UUID objects on deserialization (round-trip), across JSON and XML.
  • The team prefers a small MIT-licensed adapter over writing serializer handlers in-house, and can absorb the maintenance cost of a 2016-era dependency.

Look elsewhere when:

  • No JMS Serializer in the stack. Use Laravel API Resources, or an Eloquent cast plus accessor; this package adds nothing.
  • You need modern PHP/Ramsey compatibility. Released 2016, it predates Ramsey UUID v4 and JMS Serializer 3.x. Verify compatibility before adoption and treat it as unmaintained.
  • You want zero third-party risk. The handler is small enough (~one class plus registration/config) to vendor or re-implement in under a day — a defensible build over buy.
  • You're consolidating on symfony/serializer (the direction Laravel is drifting). Do not adopt a JMS-only adapter; write a normalizer instead.
  • Only one or two UUID fields exist. Inline __toString handling or a single local handler beats adding a dependency.

How to Pitch It (Stakeholders)

For executives (one paragraph): This is a tiny, low-cost adapter that makes UUID identifiers serialize as clean strings in our APIs instead of leaking object internals — protecting API contracts and partner integrations at essentially zero licensing cost (MIT). It is a convenience-for-maintenance-risk trade, not a strategic investment: 29 GitHub stars and a last release in 2016 mean no vendor support. Recommendation: adopt only if we are already committed to JMS Serializer, and treat forking or vendoring the single handler as the fallback so a PHP or Ramsey upgrade can never block the roadmap.

For engineering (summary): It registers a JMS Serializer handler for Ramsey\Uuid — serialize to string, deserialize back to a UUID instance — wired up via Composer plus handler registration. It removes bespoke per-DTO serialization code and keeps JSON/XML payloads UUID-friendly. Caveats to validate before adoption: JMS Serializer major version, PHP 8.x support, and Ramsey UUID v4 compatibility (package last shipped 2016). If any check fails, copy the handler into our codebase rather than depend on it — the surface area is small and the fix becomes ours to own.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route