gbprod/uuid-normalizer

Normalizer to serialize Ramsey Uuid with Symfony Serializer

Maintainers

👁 gbprod

Package info

github.com/gbprod/uuid-normalizer

pkg:composer/gbprod/uuid-normalizer

Statistics

Installs: 665 441

Dependents: 2

Suggesters: 0

Stars: 32

Open Issues: 1

v8.0.0 2026-03-02 10:48 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

WTFPL ac2e4877a5fbed7753a951f2c06563a8ac2a6e34

  • gbprod <contact.woop@gb-prod.fr>

This package is auto-updated.

Last update: 2026-05-30 11:30:11 UTC


README

👁 Tests
👁 Latest Stable Version
👁 Total Downloads
👁 Latest Unstable Version

Normalizer to serialize Ramsey Uuid using Symfony Serializer.

Installation

composer require gbprod/uuid-normalizer

Why

By default, Symfony Serializer can't handle serialization and deserialization of Ramsey Uuid. You will have that kind of errors:

Not a time-based UUID
500 Internal Server Error - UnsupportedOperationException

Setup

In your app/config/service.yml file:

services:
 uuid_normalizer:
 class: GBProd\UuidNormalizer\UuidNormalizer
 tags:
 - { name: serializer.normalizer }

 uuid_denormalizer:
 class: GBProd\UuidNormalizer\UuidDenormalizer
 tags:
 - { name: serializer.normalizer }

Or using xml:

<services>
 <service id="uuid_normalizer" class="GBProd\UuidNormalizer\UuidNormalizer">
 <tag name="serializer.normalizer" />
 </service>
 <service id="uuid_denormalizer" class="GBProd\UuidNormalizer\UuidDenormalizer">
 <tag name="serializer.normalizer" />
 </service>
</services>

Or php:

use Symfony\Component\DependencyInjection\Definition;

$definition = new Definition('GBProd\UuidNormalizer\UuidNormalizer');
$definition->addTag('serializer.normalizer');
$container->setDefinition('uuid_normalizer', $definition);

$definition = new Definition('GBProd\UuidNormalizer\UuidDenormalizer');
$definition->addTag('serializer.normalizer');
$container->setDefinition('uuid_denormalizer', $definition);

Or building your own serializer:

use GBProd\UuidNormalizer\UuidDenormalizer;
use GBProd\UuidNormalizer\UuidNormalizer;

$serializer = new Serializer([
 new UuidNormalizer(),
 new UuidDenormalizer(),
 // Other normalizers...
]);

Requirements

  • PHP 7.4+

Contributing

Feel free to contribute, see CONTRIBUTING.md file for more informations.