The Zend\Serializer component provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover.
For more information what a serializer is read the wikipedia page of Serialization.
Serializing adapters can either be created from the provided Zend\Serializer\Serializer::factory method, or by simply instantiating one of the Zend\Serializer\Adapter\* classes.
The method serialize() generates a storable string. To regenerate this serialized data you can simply call the method unserialize().
Any time an error is encountered serializing or unserializing, Zend\Serializer will throw a Zend\Serializer\Exception\ExceptionInterface.
Because of an application often uses internally only one serializer it is possible to define and use a default serializer. That serializer will be used by default by other components like Zend\Cache\Storage\Plugin\Serializer.
To configure a serializer adapter, you can optionally use an instance of Zend\Serializer\Adapter\AdapterOptions, an instance of one of the adapter specific options class, an array or an instance of Traversable. The adapter will convert it into the adapter specific options class instance (if present) or into the basic Zend\Serializer\Adapter\AdapterOptions class instance.
Options can be passed as second argument to the provided Zend\Serializer\Serializer::factory method, using the method setOptions or set as constructor argument.
Each serializer implements the interface Zend\Serializer\Adapter\AdapterInterface.
Generates a storable representation of a value.
Creates a PHP value from a stored representation.
The basic class Zend\Serializer\Serializer will be used to instantiate the adapters, to configure the factory and to handle static serializing.
Create a serializer adapter instance.
Change the adapter plugin manager.
Get the adapter plugin manager.
Resets the internal adapter plugin manager.
Generates a storable representation of a value using the default adapter. Optionally different adapter could be provided as second argument.
Creates a PHP value from a stored representation using the default adapter. Optionally different adapter could be provided as second argument.
Go to Introduction to Zend\Serializer on GitHub.