# Class HttpSoft\Message\ResponseFactory

Factory for creating HttpSoft\Message\Response, implements Psr\Http\Message\ResponseFactoryInterface.

Source code on GitHub.

use HttpSoft\Message\ResponseFactory;

$factory = new ResponseFactory();

$response = $factory->createResponse();
$response->getStatusCode(); // 200
$response->getReasonPhrase(); // 'OK'
$response->getBody()->getContents(); // ''
$response->getBody()->getMetadata('uri') // 'php://temp'
$response->getHeaders(); // []
$response->getProtocolVersion(); // '1.1'

$response = $factory->createResponse(404, '');
$response->getStatusCode(); // 404
$response->getReasonPhrase(); // 'Not Found'
$response->getBody()->getContents(); // ''
$response->getBody()->getMetadata('uri') // 'php://temp'
$response->getHeaders(); // []
$response->getProtocolVersion(); // '1.1'

# Public methods

See the original detailed description of the methods in the Psr\Http\Message\ResponseFactoryInterface.

# createResponse

Create a new HttpSoft\Message\Response instance.

public function createResponse(int $statusCode = 200, string $reasonPhrase = ''): ResponseInterface;