jms-serializer-uuid
jms-serializer-uuid copied to clipboard
Uuid serializer and deserializer for JMS Serializer library
UUID support for JMS Serializer
This library allows you to serialize and deserialize ramsey/uuid UUIDs when using JMS Serializer library.
Usage
- Install the latest version with
composer require mhujer/jms-serializer-uuid - Register a custom handler to JMS Serializer (documentation)
<?php
$builder
->configureHandlers(function(JMS\Serializer\Handler\HandlerRegistry $registry) {
$registry->registerSubscribingHandler(new \Mhujer\JmsSerializer\Uuid\UuidSerializerHandler());
})
;
or if you are using Symfony, register it as a tagged service in services.yaml:
Mhujer\JmsSerializer\Uuid\UuidSerializerHandler:
tags:
- { name: jms_serializer.subscribing_handler }
Then you can use the uuid type for serialization or deserialization:
<?php
use JMS\Serializer\Annotation as JMS;
class User
{
/**
* @JMS\Type("uuid")
* @var \Ramsey\Uuid\UuidInterface
*/
public $id;
}
Requirements
Works with PHP 8.0 or higher.
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub
Author
Changelog
3.4.1 (2021-12-07)
- #17 handle non-stringable values
3.4.0 (2021-11-05)
- #15 Drop support for PHP < 8.0
- #16 Add support for PHP 8.1
3.3.0 (2020-12-31)
- #12 Drop support for PHP < 7.4
- #11 Add support for PHP 8.0 (thank you @ahilles107!)
3.2.0 (2020-05-17)
- #10 Add support for ramsey/uuid v4 (thank you @simPod!)
3.1.0 (2019-05-31)
- #8 #9 Add
jms/serializer3.0 support (thank you @ilyashtrikul and @simPod!)
3.0.0 (2018-11-27)
- #6 dropped support for PHP 7.1 as it is no longer supported
- #7 Require
jms/serializer2.0
2.0.0 (2018-01-05)
- #3 require PHP 7.1, potential BC breaks because of added type-hints
1.0.1 (2016-08-22)
- #1 fixed serialization to XML
1.0.0 (2016-05-28)
- initial release

