PHPackages                             scattercz/consistence-jms-serializer-symfony - 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. [API Development](/categories/api)
4. /
5. scattercz/consistence-jms-serializer-symfony

ActiveLibrary[API Development](/categories/api)

scattercz/consistence-jms-serializer-symfony
============================================

Symfony Bundle integrating Consistence library and JMS Serializer with Symfony 5 support

3.0(5y ago)03MITPHPPHP ~7.2

Since Jan 17Pushed 5y agoCompare

[ Source](https://github.com/scattercz/consistence-jms-serializer-symfony)[ Packagist](https://packagist.org/packages/scattercz/consistence-jms-serializer-symfony)[ RSS](/packages/scattercz-consistence-jms-serializer-symfony/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (11)Versions (8)Used By (0)

Symfony Bundle integrating Consistence library and JMS Serializer with Symfony 5 support
========================================================================================

[](#symfony-bundle-integrating-consistence-library-and-jms-serializer-with-symfony-5-support)

[![Travis CI](https://camo.githubusercontent.com/2b04149a0b4ba05e4b0761e49d1b023d5506a8788ec2e932fe0c56a07bc1bcd6/68747470733a2f2f7472617669732d63692e6f72672f73636174746572637a2f636f6e73697374656e63652d6a6d732d73657269616c697a65722d73796d666f6e792e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/2b04149a0b4ba05e4b0761e49d1b023d5506a8788ec2e932fe0c56a07bc1bcd6/68747470733a2f2f7472617669732d63692e6f72672f73636174746572637a2f636f6e73697374656e63652d6a6d732d73657269616c697a65722d73796d666f6e792e7376673f6272616e63683d6d6173746572)

> This is a Symfony bundle providing integration for the standalone package [`consistence/consistence-jms-serializer`](https://github.com/consistence/consistence-jms-serializer), if you are not using Symfony, follow instructions there.

This bundle provides integration of [Consistence](https://github.com/consistence/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/consistence/blob/master/docs/Enum/enums.md), see the examples below.

This bundle was updated so it is now working in Symfony 5 and PHP 7.4.

Usage
-----

[](#usage)

[Enums](https://github.com/consistence/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/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:

```
