Skip to content

Uuid serializer and deserializer for JMS Serializer library

License

Notifications You must be signed in to change notification settings

p4veI/jms-serializer-uuid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UUID support for JMS Serializer Build Status

Latest Stable Version Total Downloads License Coverage Status

This library allows you to serialize and deserialize ramsey/uuid UUIDs when using JMS Serializer library.

There is a Symfony Bundle for using this library in a Symfony application.

Usage

  1. Install the latest version with composer require mhujer/jms-serializer-uuid
  2. 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:

mhujer.jms_serializer.uuid.uuid_serializer_handler:
    class: 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 7.4 or higher.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Author

Martin Hujer

Changelog

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/serializer 3.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/serializer 2.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

About

Uuid serializer and deserializer for JMS Serializer library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%