This Bundle integrates mhujer/jms-serializer-uuid into Symfony.
- Install the latest version with
composer require mhujer/jms-serializer-uuid-bundle
- Register the Bundle in the
AppKernel.php
:
<?php
class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
...
public function registerBundles()
{
$bundles = [
...
new Mhujer\JmsSerializer\Uuid\SymfonyBundle\MhujerJmsSerializerUuidBundle()
];
}
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;
}
Works with PHP 7.2 or higher.
Bugs and feature request are tracked on GitHub
Thanks Vašek Purchart for ideas how to test Symfony DI extension!
- #6 dropped support for PHP 7.1 as it is no longer supported
- #7
jms/serializer
2.0 support (thanks @simPod !)
- #3 Added Symfony 4.0 support, dropped support for Symfony 2. Requires PHP 7.1.
- #1 Support for JMS Serializer Bundle 2.0 (thanks @VasekPurchart !)
- initial release