-
Notifications
You must be signed in to change notification settings - Fork 2
Message: withBody Example
Terry L edited this page Jun 20, 2020
·
3 revisions
Shieldon\Psr7\Message
Return an instance with the specified message body.
-
param
StreamInterface
body*
Body. -
return
static
Example:
$stream = new \Shieldon\Psr7\Stream(fopen('php://temp', 'r+'));
$stream->write('Foo Bar');
$message = $message->withBody($stream);
echo $message->getBody()->getContents();
// Outputs: Foo Bar
composer require shieldon/psr-http
Shieldon PSR HTTP implementation written by Terry L. from Taiwan.