Skip to content

ResponseFactory: createResponse Example

Terry L edited this page Jun 21, 2020 · 4 revisions

Shieldon\Psr17\ResponseFactory

createResponse($code, $reasonPhrase)

Create a new response.

  • param int code = 200 The HTTP status code.
  • param string reasonPhrase = '' The reason phrase to associate with the status code.
  • return ResponseInterface

Example:

use Shieldon\Psr17\ResponseFactory;

$responseFactory = new ResponseFactory();
$response = $responseFactory->createResponse(200, 'OK');
Clone this wiki locally