Skip to content

PSR 17: ResponseFactory Example

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

PSR 17 Factories

Namespace

Shieldon\Psr17\ResponseFactory

ResponseFactory

__construct

None

createResponse($code, $reasonPhrase)

  • 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