class WebHttpServer extends HttpServer (View source)

The WebServer class.

Constants

CACHE_ENABLE

CACHE_DISABLE

CACHE_CUSTOM_HEADER

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)

Server constructor.

listen(callable $errorHandler = null)

listen

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

ResponseInterface
execute(callable $nextHandler = null)

execute

ResponseInterface
prepareCache(ResponseInterface $response)

prepareCache

string
getContentType()

Method to get property MimeType

setContentType(string $contentType)

Method to set property mimeType

string
getCharSet()

Method to get property CharSet

setCharSet(string $charSet)

Method to set property charSet

getModifiedDate()

Method to get property ModifiedDate

setModifiedDate(DateTime $modifiedDate)

Method to set property modifiedDate

getUriData()

Method to get property UriData

setUriData(array|UriData $uriData)

Method to set property uriData

mixed
__get(string $name)

__get

getCompressor()

Method to get property Compressor

setCompressor(HttpCompressor $compressor)

Method to set property compressor

boolean
getCachable()

Method to get property Cachable

cachable(boolean $cachable = self::CACHE_CUSTOM_HEADER)

Method to set property cachable

createHttpCompressor(string $acceptEncoding = null)

Create Compressor object.

Details

in HttpServer 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.

in HttpServer 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 91
__construct(callable $handler = null, ServerRequestInterface $request, ResponseInterface $response = null, OutputInterface $output = null)

Server constructor.

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 107
listen(callable $errorHandler = null)

listen

Parameters

callable $errorHandler The error handler callback.

in HttpServer at line line 143
callable getHandler()

Method to get property Handler

Return Value

callable

in HttpServer at line line 155
HttpServer setHandler(callable $handler)

Method to set property handler

Parameters

callable $handler

Return Value

HttpServer Return self to support chaining.

in HttpServer at line line 167
ServerRequestInterface getRequest()

Method to get property Request

Return Value

ServerRequestInterface

in HttpServer at line line 179
HttpServer setRequest(ServerRequestInterface $request)

Method to set property request

Parameters

ServerRequestInterface $request

Return Value

HttpServer Return self to support chaining.

in HttpServer at line line 191
OutputInterface getOutput()

Method to get property Output

Return Value

OutputInterface

in HttpServer at line line 208
HttpServer setOutput(Output $output)

Method to set property output

Parameters

Output $output

Return Value

HttpServer Return self to support chaining.

in HttpServer at line line 220
ResponseInterface getResponse()

Method to get property Response

Return Value

ResponseInterface

in HttpServer at line line 232
HttpServer setResponse(ResponseInterface $response)

Method to set property response

Parameters

ResponseInterface $response

Return Value

HttpServer Return self to support chaining.

at line line 121
ResponseInterface execute(callable $nextHandler = null)

execute

Parameters

callable $nextHandler

Return Value

ResponseInterface

at line line 150
ResponseInterface prepareCache(ResponseInterface $response)

prepareCache

Parameters

ResponseInterface $response

Return Value

ResponseInterface

at line line 286
string getContentType()

Method to get property MimeType

Return Value

string

at line line 298
WebHttpServer setContentType(string $contentType)

Method to set property mimeType

Parameters

string $contentType

Return Value

WebHttpServer Return self to support chaining.

at line line 310
string getCharSet()

Method to get property CharSet

Return Value

string

at line line 322
WebHttpServer setCharSet(string $charSet)

Method to set property charSet

Parameters

string $charSet

Return Value

WebHttpServer Return self to support chaining.

at line line 334
DateTime getModifiedDate()

Method to get property ModifiedDate

Return Value

DateTime

at line line 346
WebHttpServer setModifiedDate(DateTime $modifiedDate)

Method to set property modifiedDate

Parameters

DateTime $modifiedDate

Return Value

WebHttpServer Return self to support chaining.

at line line 358
UriData getUriData()

Method to get property UriData

Return Value

UriData

at line line 370
WebHttpServer setUriData(array|UriData $uriData)

Method to set property uriData

Parameters

array|UriData $uriData

Return Value

WebHttpServer Return self to support chaining.

at line line 389
mixed __get(string $name)

__get

Parameters

string $name

Return Value

mixed

at line line 409
HttpCompressor getCompressor()

Method to get property Compressor

Return Value

HttpCompressor

at line line 421
WebHttpServer setCompressor(HttpCompressor $compressor)

Method to set property compressor

Parameters

HttpCompressor $compressor

Return Value

WebHttpServer Return self to support chaining.

at line line 433
boolean getCachable()

Method to get property Cachable

Return Value

boolean

at line line 445
WebHttpServer cachable(boolean $cachable = self::CACHE_CUSTOM_HEADER)

Method to set property cachable

Parameters

boolean $cachable

Return Value

WebHttpServer Return self to support chaining.

at line line 459
HttpCompressor createHttpCompressor(string $acceptEncoding = null)

Create Compressor object.

Parameters

string $acceptEncoding The HTTPACCEPTENCODING param, the common is "gzip, deflate".

Return Value

HttpCompressor