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.
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.Consider it when all of the following hold:
symfony/serializer. JMS is the prerequisite, and it is not the Laravel default.Ramsey\Uuid\Uuid / UuidInterface values.Look elsewhere when:
cast plus accessor; this package adds nothing.symfony/serializer (the direction Laravel is drifting). Do not adopt a JMS-only adapter; write a normalizer instead.__toString handling or a single local handler beats adding a dependency.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.
How can I help you explore Laravel packages today?