Server
extends AbstractHttp
in package
HTTP server class
Tags
Table of Contents
Properties
- $request : AbstractRequest|null
- Request
- $response : AbstractResponse|null
- Response
- $request : AbstractRequest|null
- Request
- $response : AbstractResponse|null
- Response
Methods
- __construct() : mixed
- Instantiate the server object
- __get() : mixed
- Magic method to get the request or response object
- __toString() : string
- Render response as a raw string
- createWithBasePath() : Server
- Create server object with a base path reference for the request URI
- getHeadersAsString() : string
- Get the response headers as a string
- getRequest() : AbstractRequest
- Get the request
- getResponse() : AbstractResponse
- Get the response
- hasRequest() : bool
- Has request
- hasResponse() : bool
- Get the response
- isAccepted() : bool|null
- Determine if the response is 202 accepted
- isBadGateway() : bool|null
- Determine if the response is a 502 Bad Gateway
- isBadRequest() : bool|null
- Determine if the response is a 400 Bad Request
- isClientError() : bool|null
- Determine if the response is a client error
- isComplete() : bool
- Determine if the response is complete
- isConflict() : bool|null
- Determine if the response is a 409 Conflict
- isContinue() : bool|null
- Determine if the response is a continue
- isCreated() : bool|null
- Determine if the response is 201 created
- isError() : bool|null
- Determine if the response is an error
- isForbidden() : bool|null
- Determine if the response is a 403 Forbidden
- isFound() : bool|null
- Determine if the response is a 302 Found
- isInternalServerError() : bool|null
- Determine if the response is a 500 Internal Server Error
- isLengthRequired() : bool|null
- Determine if the response is a 411 Length Required
- isMethodNotAllowed() : bool|null
- Determine if the response is a 405 Method Not Allowed
- isMovedPermanently() : bool|null
- Determine if the response is a 301 Moved Permanently
- isNoContent() : bool|null
- Determine if the response is 204 No Content
- isNotAcceptable() : bool|null
- Determine if the response is a 406 Not Acceptable
- isNotFound() : bool|null
- Determine if the response is a 404 Not Found
- isOk() : bool|null
- Determine if the response is 200 OK
- isRedirect() : bool|null
- Determine if the response is a redirect
- isRequestTimeout() : bool|null
- Determine if the response is a 408 Request Timeout
- isServerError() : bool|null
- Determine if the response is a server error
- isServiceUnavailable() : bool|null
- Determine if the response is a 503 Service Unavailable
- isSuccess() : bool|null
- Determine if the response is a success
- isTooManyRequests() : bool|null
- Determine if the response is a 429 Too Many Requests
- isUnauthorized() : bool|null
- Determine if the response is a 401 Unauthorized
- isUnprocessableEntity() : bool|null
- Determine if the response is a 422 Unprocessable Entity
- isUnsupportedMediaType() : bool|null
- Determine if the response is a 415 Unsupported Media Type
- render() : string
- Render response as a raw string
- request() : Request
- Get request (shorthand)
- response() : Response
- Get response (shorthand)
- send() : void
- Send the server response
- sendAndExit() : void
- Send the server response and exit
- sendHeaders() : void
- Send response headers
- setRequest() : AbstractHttp
- Set the request
- setResponse() : AbstractHttp
- Set the response
Properties
$request
Request
public
AbstractRequest|null
$request
Server\Request
$response
Response
public
AbstractResponse|null
$response
Server\Response
$request
Request
protected
AbstractRequest|null
$request
= null
$response
Response
protected
AbstractResponse|null
$response
= null
Methods
__construct()
Instantiate the server object
public
__construct([Request|null $request = new ServerRequest(new Uri()) ][, Response|null $response = new ServerResponse() ]) : mixed
Parameters
__get()
Magic method to get the request or response object
public
__get(string $name) : mixed
Parameters
- $name : string
__toString()
Render response as a raw string
public
__toString() : string
Return values
stringcreateWithBasePath()
Create server object with a base path reference for the request URI
public
static createWithBasePath(string $basePath[, mixed $filters = null ][, mixed $streamToFile = null ]) : Server
Parameters
- $basePath : string
- $filters : mixed = null
- $streamToFile : mixed = null
Return values
ServergetHeadersAsString()
Get the response headers as a string
public
getHeadersAsString([mixed $status = null ][, string $eol = "
" ]) : string
Parameters
- $status : mixed = null
- $eol : string = " "
Return values
stringgetRequest()
Get the request
public
getRequest() : AbstractRequest
Return values
AbstractRequestgetResponse()
Get the response
public
getResponse() : AbstractResponse
Return values
AbstractResponsehasRequest()
Has request
public
hasRequest() : bool
Return values
boolhasResponse()
Get the response
public
hasResponse() : bool
Return values
boolisAccepted()
Determine if the response is 202 accepted
public
isAccepted() : bool|null
Return values
bool|nullisBadGateway()
Determine if the response is a 502 Bad Gateway
public
isBadGateway() : bool|null
Return values
bool|nullisBadRequest()
Determine if the response is a 400 Bad Request
public
isBadRequest() : bool|null
Return values
bool|nullisClientError()
Determine if the response is a client error
public
isClientError() : bool|null
Return values
bool|nullisComplete()
Determine if the response is complete
public
isComplete() : bool
Return values
boolisConflict()
Determine if the response is a 409 Conflict
public
isConflict() : bool|null
Return values
bool|nullisContinue()
Determine if the response is a continue
public
isContinue() : bool|null
Return values
bool|nullisCreated()
Determine if the response is 201 created
public
isCreated() : bool|null
Return values
bool|nullisError()
Determine if the response is an error
public
isError() : bool|null
Return values
bool|nullisForbidden()
Determine if the response is a 403 Forbidden
public
isForbidden() : bool|null
Return values
bool|nullisFound()
Determine if the response is a 302 Found
public
isFound() : bool|null
Return values
bool|nullisInternalServerError()
Determine if the response is a 500 Internal Server Error
public
isInternalServerError() : bool|null
Return values
bool|nullisLengthRequired()
Determine if the response is a 411 Length Required
public
isLengthRequired() : bool|null
Return values
bool|nullisMethodNotAllowed()
Determine if the response is a 405 Method Not Allowed
public
isMethodNotAllowed() : bool|null
Return values
bool|nullisMovedPermanently()
Determine if the response is a 301 Moved Permanently
public
isMovedPermanently() : bool|null
Return values
bool|nullisNoContent()
Determine if the response is 204 No Content
public
isNoContent() : bool|null
Return values
bool|nullisNotAcceptable()
Determine if the response is a 406 Not Acceptable
public
isNotAcceptable() : bool|null
Return values
bool|nullisNotFound()
Determine if the response is a 404 Not Found
public
isNotFound() : bool|null
Return values
bool|nullisOk()
Determine if the response is 200 OK
public
isOk() : bool|null
Return values
bool|nullisRedirect()
Determine if the response is a redirect
public
isRedirect() : bool|null
Return values
bool|nullisRequestTimeout()
Determine if the response is a 408 Request Timeout
public
isRequestTimeout() : bool|null
Return values
bool|nullisServerError()
Determine if the response is a server error
public
isServerError() : bool|null
Return values
bool|nullisServiceUnavailable()
Determine if the response is a 503 Service Unavailable
public
isServiceUnavailable() : bool|null
Return values
bool|nullisSuccess()
Determine if the response is a success
public
isSuccess() : bool|null
Return values
bool|nullisTooManyRequests()
Determine if the response is a 429 Too Many Requests
public
isTooManyRequests() : bool|null
Return values
bool|nullisUnauthorized()
Determine if the response is a 401 Unauthorized
public
isUnauthorized() : bool|null
Return values
bool|nullisUnprocessableEntity()
Determine if the response is a 422 Unprocessable Entity
public
isUnprocessableEntity() : bool|null
Return values
bool|nullisUnsupportedMediaType()
Determine if the response is a 415 Unsupported Media Type
public
isUnsupportedMediaType() : bool|null
Return values
bool|nullrender()
Render response as a raw string
public
render() : string
Return values
stringrequest()
Get request (shorthand)
public
request() : Request
Return values
Requestresponse()
Get response (shorthand)
public
response() : Response
Return values
Responsesend()
Send the server response
public
send([int|null $code = null ][, array<string|int, mixed>|null $headers = null ][, bool $length = false ]) : void
Parameters
- $code : int|null = null
- $headers : array<string|int, mixed>|null = null
- $length : bool = false
sendAndExit()
Send the server response and exit
public
sendAndExit([int|null $code = null ][, array<string|int, mixed>|null $headers = null ][, bool $length = false ]) : void
Parameters
- $code : int|null = null
- $headers : array<string|int, mixed>|null = null
- $length : bool = false
sendHeaders()
Send response headers
public
sendHeaders() : void
Tags
setRequest()
Set the request
public
setRequest(AbstractRequest $request) : AbstractHttp
Parameters
- $request : AbstractRequest
Return values
AbstractHttpsetResponse()
Set the response
public
setResponse(AbstractResponse $response) : AbstractHttp
Parameters
- $response : AbstractResponse