Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mhujer/jms-serializer-uuid
Uuid serializer and deserializer for JMS Serializer library
https://github.com/mhujer/jms-serializer-uuid
Last synced: about 1 month ago
JSON representation
Uuid serializer and deserializer for JMS Serializer library
- Host: GitHub
- URL: https://github.com/mhujer/jms-serializer-uuid
- Owner: mhujer
- License: mit
- Created: 2016-05-14T21:10:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-07T08:16:20.000Z (about 3 years ago)
- Last Synced: 2024-10-29T00:56:36.658Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 35.2 KB
- Stars: 29
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UUID support for JMS Serializer
[![Latest Stable Version](https://poser.pugx.org/mhujer/jms-serializer-uuid/version.png)](https://packagist.org/packages/mhujer/jms-serializer-uuid) [![Total Downloads](https://poser.pugx.org/mhujer/jms-serializer-uuid/downloads.png)](https://packagist.org/packages/mhujer/jms-serializer-uuid) [![License](https://poser.pugx.org/mhujer/jms-serializer-uuid/license.svg)](https://packagist.org/packages/mhujer/jms-serializer-uuid) [![Coverage Status](https://coveralls.io/repos/github/mhujer/jms-serializer-uuid/badge.svg?branch=master)](https://coveralls.io/github/mhujer/jms-serializer-uuid?branch=master)
This library allows you to serialize and deserialize [ramsey/uuid](https://github.com/ramsey/uuid) UUIDs
when using [JMS Serializer library](https://github.com/schmittjoh/serializer).Usage
----
1. Install the latest version with `composer require mhujer/jms-serializer-uuid`
2. Register a custom handler to JMS Serializer ([documentation](https://jmsyst.com/libs/serializer/master/handlers))```php
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`:
```yml
Mhujer\JmsSerializer\Uuid\UuidSerializerHandler:
tags:
- { name: jms_serializer.subscribing_handler }```
Then you can use the `uuid` type for serialization or deserialization:
```php