interface ServerInterface (View source)

Methods

setDispatcher(DispatcherInterface $dispatcher)

Set the dispatcher this server uses.

addMiddleware(MiddlewareInterface $middleware, int $priority = 10)

Add a middlware callable to the stack Middleware are callables that get an opportunity to do stuff with the request during handling.

removeMiddleware(MiddlewareInterface $middleware)

Remove a middleware

Response
handleRequest(Request $request)

Handle a request and return a response

Details

ServerInterface setDispatcher(DispatcherInterface $dispatcher)

Set the dispatcher this server uses.

A dispatcher is used to handle the final conversion from request to response function ($request, $response) : Response;

Parameters

DispatcherInterface $dispatcher

Return Value

ServerInterface

ServerInterface addMiddleware(MiddlewareInterface $middleware, int $priority = 10)

Add a middlware callable to the stack Middleware are callables that get an opportunity to do stuff with the request during handling.

Parameters

MiddlewareInterface $middleware
int $priority

Lower priority runs first

Return Value

ServerInterface

ServerInterface removeMiddleware(MiddlewareInterface $middleware)

Remove a middleware

Parameters

MiddlewareInterface $middleware

Return Value

ServerInterface

Response handleRequest(Request $request)

Handle a request and return a response

Parameters

Request $request

Return Value

Response