Body
class Body implements Serializable (View source)
The message body, represented as a PHP (temporary) stream.
NOTE: Currently, http\Message\Body::addForm() creates multipart/form-data bodies.
Methods
Create a new message body, optionally referencing $stream.
String cast handler.
Add form fields and files to the message body.
Retrieve the ETag of the body.
Retrieve any boundary of the message body.
Retrieve the underlying stream resource.
Implements Serializable.
Stat size, atime, mtime and/or ctime.
Stream the message body through a callback.
Stream the message body into another stream $stream, starting from $offset, streaming $maxlen at most.
Retrieve the message body serialized to a string.
Implements Serializable.
Details
__construct(resource $stream = null)
Create a new message body, optionally referencing $stream.
string
__toString()
String cast handler.
Body
addForm(array $fields = null, array $files = null)
Add form fields and files to the message body.
NOTE: Currently, http\Message\Body::addForm() creates "multipart/form-data" bodies.
Body
addPart(Message $part)
Add a part to a multipart body.
Body
append(string $data)
Append plain bytes to the message body.
string|false
etag()
Retrieve the ETag of the body.
string|null
getBoundary()
Retrieve any boundary of the message body.
See http\Message::splitMultipartBody().
resource
getResource()
Retrieve the underlying stream resource.
string|null
serialize()
Implements Serializable.
Alias of http\Message\Body::__toString().
int|object
stat(string $field = null)
Stat size, atime, mtime and/or ctime.
Body
toCallback(callable $callback, int $offset = 0, int $maxlen = 0)
Stream the message body through a callback.
Body
toStream(resource $stream, int $offset = 0, int $maxlen = 0)
Stream the message body into another stream $stream, starting from $offset, streaming $maxlen at most.
string
toString()
Retrieve the message body serialized to a string.
Alias of http\Message\Body::__toString().
void
unserialize(string $serialized)
Implements Serializable.