UUIDs with serializer in Symfony

UUIDs with serializer in Symfony

Internally I've long switched to UUIDs instead of auto increment columns for my Doctrine entities. But as soon as I'm in the realm of business logic or serialization, I always convert the UUIDs to strings. Which doesn't really makes sense as I loose a layer of type safety through that.

Luckily I stumbled over the uuid-normalizer package which extends the Symfony serializer and adds to option to serialize UUIDs from Ramsey Uuid. Now I'm able to use UUIDs everywhere.

gbprod/uuid-normalizer
Normalizer to serialize Ramsey Uuid with Symfony Serializer - gbprod/uuid-normalizer