Documentation

PayloadHandler
in package
implements RequestHandlerInterface uses DefaultHandlerTrait

A very simple payload handler.

Derive classes from this handler only for very basic use cases.

Otherwise, override at least handle() and implement interaction with the body stream and headers as needed.

Table of Contents

Interfaces

RequestHandlerInterface

Properties

$responseFactory  : ResponseFactoryInterface
$streamFactory  : StreamFactoryInterface

Methods

__construct()  : mixed
handle()  : ResponseInterface
Handle a request
bodyContent()  : string
Overload this function to return different body content.
returnCode()  : int
Overload this function to change the return code

Properties

Methods

__construct()

public __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory) : mixed
Parameters
$responseFactory : ResponseFactoryInterface
$streamFactory : StreamFactoryInterface

handle()

Handle a request

public handle(RequestInterface $request) : ResponseInterface

Each middleware will either create a response or return control to the handler.

If the middlewares created no response, the payload handler will.

Finally the we will return a response ourselves.

Parameters
$request : RequestInterface
Return values
ResponseInterface

bodyContent()

Overload this function to return different body content.

protected bodyContent() : string
Return values
string

returnCode()

Overload this function to change the return code

protected returnCode() : int
Return values
int

        
On this page

Search results