class HttpServer (View source)

The Server class.

Methods

static HttpServer
createFromGlobals(callable $handler = null, array $server = array(), array $query = array(), array $body = array(), array $cookies = array(), array $files = array())

Create a Server instance

static HttpServer
create(callable $handler = null, ServerRequestInterface $request, ResponseInterface $response = null, OutputInterface $output = null)

Create a Server instance from an existing request object

__construct(callable $handler = null, ServerRequestInterface $request, ResponseInterface $response = null, OutputInterface $output = null)

Create a Server instance from an existing request object

listen(callable $errorHandler = null)

Execute the server.

callable
getHandler()

Method to get property Handler

setHandler(callable $handler)

Method to set property handler

ServerRequestInterface
getRequest()

Method to get property Request

setRequest(ServerRequestInterface $request)

Method to set property request

getOutput()

Method to get property Output

setOutput(Output $output)

Method to set property output

ResponseInterface
getResponse()

Method to get property Response

setResponse(ResponseInterface $response)

Method to set property response

Details

at line line 68
static HttpServer createFromGlobals(callable $handler = null, array $server = array(), array $query = array(), array $body = array(), array $cookies = array(), array $files = array())

Create a Server instance

Creates a server instance from the callback and the following PHP environmental values:

Parameters

callable $handler The server handler.
array $server The server variable. Typically this will be the $_SERVER superglobal.
array $query The GET uri query. Typically this will be the $_GET superglobal.
array $body The POST body. Typically this will be the $_POST superglobal.
array $cookies The cookies. Typically this will be the $_COOKIE superglobal
array $files The uploaded file data. Typically this will be the $_FILES superglobal.

Return Value

HttpServer The Server instance.

at line line 90
static HttpServer create(callable $handler = null, ServerRequestInterface $request, ResponseInterface $response = null, OutputInterface $output = null)

Create a Server instance from an existing request object

Provided a callback, an existing request object, and optionally an existing response object, create and return the Server instance.

If no Response object is provided, one will be created.

Parameters

callable $handler The server handler.
ServerRequestInterface $request The Request object.
ResponseInterface $response The Response object.
OutputInterface $output The Output emitter object.

Return Value

HttpServer The Server instance.

at line line 108
__construct(callable $handler = null, ServerRequestInterface $request, ResponseInterface $response = null, OutputInterface $output = null)

Create a Server instance from an existing request object

Provided a callback, an existing request object, and optionally an existing response object, create and return the Server instance.

If no Response object is provided, one will be created.

Parameters

callable $handler The server handler.
ServerRequestInterface $request The Request object.
ResponseInterface $response The Response object.
OutputInterface $output The Output emitter object.

at line line 121
listen(callable $errorHandler = null)

Execute the server.

Parameters

callable $errorHandler The error handler callback.

at line line 143
callable getHandler()

Method to get property Handler

Return Value

callable

at line line 155
HttpServer setHandler(callable $handler)

Method to set property handler

Parameters

callable $handler

Return Value

HttpServer Return self to support chaining.

at line line 167
ServerRequestInterface getRequest()

Method to get property Request

Return Value

ServerRequestInterface

at line line 179
HttpServer setRequest(ServerRequestInterface $request)

Method to set property request

Parameters

ServerRequestInterface $request

Return Value

HttpServer Return self to support chaining.

at line line 191
OutputInterface getOutput()

Method to get property Output

Return Value

OutputInterface

at line line 208
HttpServer setOutput(Output $output)

Method to set property output

Parameters

Output $output

Return Value

HttpServer Return self to support chaining.

at line line 220
ResponseInterface getResponse()

Method to get property Response

Return Value

ResponseInterface

at line line 232
HttpServer setResponse(ResponseInterface $response)

Method to set property response

Parameters

ResponseInterface $response

Return Value

HttpServer Return self to support chaining.