Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Latest commit

 

History

History
21 lines (15 loc) · 656 Bytes

File metadata and controls

21 lines (15 loc) · 656 Bytes

Usage

The bundle just integrates the Ivory Serializer library into Symfony. In order to use the library, you can fetch the serializer from the container and use it for serializing or deserializing your data:

use Ivory\Serializer\Format;

$stdClass = new \stdClass();
$stdClass->foo = true;
$stdClass->bar = ['foo', [123, 432.1]];

$serializer = $container->get('ivory.serializer');

echo $serializer->serialize($stdClass, Format::JSON);
// {"foo": true,"bar": ["foo", [123, 432.1]]}

$deserialize = $serializer->deserialize($json, \stdClass::class, Format::JSON);
// $deserialize == $stdClass