PHPackages                             consistence-community/consistence-jms-serializer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. consistence-community/consistence-jms-serializer

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

consistence-community/consistence-jms-serializer
================================================

Integration of Consistence library with JMS Serializer

2.2.1(4y ago)2269.1k↓50%MITPHPPHP ~8.0

Since Jan 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/consistence-community/consistence-jms-serializer)[ Packagist](https://packagist.org/packages/consistence-community/consistence-jms-serializer)[ RSS](/packages/consistence-community-consistence-jms-serializer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (11)Used By (0)

Integration of Consistence library with JMS Serializer
======================================================

[](#integration-of-consistence-library-with-jms-serializer)

**This package is a fork of [`consistence/consistence-jms-serializer`](https://github.com/consistence/consistence-jms-serializer) maintained by community to support new PHP versions.**

---

This library provides integration of [Consistence](https://github.com/consistence-community/consistence) value objects for [JMS Serializer](http://jmsyst.com/libs/serializer) so that you can use them in your serialization mappings.

For now, the only integration which is needed is for [Enums](https://github.com/consistence-community/consistence/blob/master/docs/Enum/enums.md), see the examples below.

Usage
-----

[](#usage)

[Enums](https://github.com/consistence-community/consistence/blob/master/docs/Enum/enums.md) represent predefined set of values and of course, you will want to serialize and deserialize these values as well. Since [`Enums`](https://github.com/consistence-community/consistence/blob/master/src/Enum/Enum.php) are objects and you only want to (de)serialize represented value, there has to be some mapping.

You can see it in this example where you want to (de)serialize sex for your `User`s:

```
