# Class HttpSoft\Message\Response
Class, that implements Psr\Http\Message\ResponseInterface.
use HttpSoft\Message\Response;
$response = new Response();
$response->getStatusCode(); // 200
$response->getReasonPhrase(); // 'OK'
$response->getBody()->getContents(); // ''
$response->getBody()->getMetadata('uri') // 'php://temp'
$response->getHeaders(); // []
$response->getProtocolVersion(); // '1.1'
$response = new Response(404, ['Content-Language' => 'en'], 'php://memory', '2');
$response->getStatusCode(); // 404
$response->getReasonPhrase(); // 'Not Found'
$response->getBody()->getContents(); // ''
$response->getBody()->getMetadata('uri') // 'php://memory'
$response->getHeaders(); // ['Content-Language' => ['en']]
$response->getProtocolVersion(); // '2'
$newResponse = $response->withHeader('Content-Type', 'text/plain');
$newResponse->getHeaderLine('content-type'); // 'text/plain'
$newResponse->getHeaders(); // ['Content-Language' => ['ru'], 'Content-Type' => ['text/plain']]
$newResponse = $response->withStatus(500);
$newResponse->getStatusCode(); // 500
$newResponse->getReasonPhrase(); // 'Internal Server Error'
$newResponse = $response->withStatus(599, 'Custom Phrase');
$newResponse->getStatusCode(); // 599
$newResponse->getReasonPhrase(); // 'Custom Phrase'
# Public methods
See the original detailed description of the methods in the Psr\Http\Message\ResponseInterface.
/**
* @param int $statusCode
* @param array $headers
* @param StreamInterface|string|resource $body
* @param string $protocol
* @param string $reasonPhrase
*/
public function __construct(
int $statusCode = 200,
array $headers = [],
$body = 'php://temp',
string $protocol = '1.1',
string $reasonPhrase = ''
);
All other methods with descriptions are in the used traits (HttpSoft\Message\ResponseTrait and HttpSoft\Message\MessageTrait).