Skip to content

Serializers#

Serializers take objects that implement the Persistable interface and convert them into blobs of data called encodings. Encodings can then be used to either store an object or to reinstantiate an object from storage.

Serialize#

To serialize a persistable object into an encoding:

public serialize(Persistable $persistable) : Encoding

$encoding = $serializer->serialize($persistable);

Deserialize#

To deserialize a persistable object from an encoding:

public deserialize(Encoding $encoding) : Persistable

$persistable = $serializer->deserialize($encoding);

Last update: 2021-04-08