Serialization

At times, it's useful to either create a string representation of a message (serialization), or to cast a string or stream message to an object (deserialization). This package provides features for this in Zend\Diactoros\Request\Serializer and Zend\Diactoros\Response\Serializer; each provides the following static methods:

The deserialization methods (from*()) will raise exceptions if errors occur while parsing the message. The serialization methods (toString()) will raise exceptions if required data for serialization is not present in the message instance.