Documentation

Server extends AbstractHttp
in package

HTTP server class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.2.0

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

Methods

__construct()

Instantiate the server object

public __construct([Request|null $request = new ServerRequest(new Uri()) ][, Response|null $response = new ServerResponse() ]) : mixed
Parameters
$request : Request|null = new ServerRequest(new Uri())
$response : Response|null = new ServerResponse()

__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
string

createWithBasePath()

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
Server

getHeadersAsString()

Get the response headers as a string

public getHeadersAsString([mixed $status = null ][, string $eol = " " ]) : string
Parameters
$status : mixed = null
$eol : string = " "
Return values
string

hasRequest()

Has request

public hasRequest() : bool
Return values
bool

hasResponse()

Get the response

public hasResponse() : bool
Return values
bool

isAccepted()

Determine if the response is 202 accepted

public isAccepted() : bool|null
Return values
bool|null

isBadGateway()

Determine if the response is a 502 Bad Gateway

public isBadGateway() : bool|null
Return values
bool|null

isBadRequest()

Determine if the response is a 400 Bad Request

public isBadRequest() : bool|null
Return values
bool|null

isClientError()

Determine if the response is a client error

public isClientError() : bool|null
Return values
bool|null

isComplete()

Determine if the response is complete

public isComplete() : bool
Return values
bool

isConflict()

Determine if the response is a 409 Conflict

public isConflict() : bool|null
Return values
bool|null

isContinue()

Determine if the response is a continue

public isContinue() : bool|null
Return values
bool|null

isCreated()

Determine if the response is 201 created

public isCreated() : bool|null
Return values
bool|null

isError()

Determine if the response is an error

public isError() : bool|null
Return values
bool|null

isForbidden()

Determine if the response is a 403 Forbidden

public isForbidden() : bool|null
Return values
bool|null

isFound()

Determine if the response is a 302 Found

public isFound() : bool|null
Return values
bool|null

isInternalServerError()

Determine if the response is a 500 Internal Server Error

public isInternalServerError() : bool|null
Return values
bool|null

isLengthRequired()

Determine if the response is a 411 Length Required

public isLengthRequired() : bool|null
Return values
bool|null

isMethodNotAllowed()

Determine if the response is a 405 Method Not Allowed

public isMethodNotAllowed() : bool|null
Return values
bool|null

isMovedPermanently()

Determine if the response is a 301 Moved Permanently

public isMovedPermanently() : bool|null
Return values
bool|null

isNoContent()

Determine if the response is 204 No Content

public isNoContent() : bool|null
Return values
bool|null

isNotAcceptable()

Determine if the response is a 406 Not Acceptable

public isNotAcceptable() : bool|null
Return values
bool|null

isNotFound()

Determine if the response is a 404 Not Found

public isNotFound() : bool|null
Return values
bool|null

isOk()

Determine if the response is 200 OK

public isOk() : bool|null
Return values
bool|null

isRedirect()

Determine if the response is a redirect

public isRedirect() : bool|null
Return values
bool|null

isRequestTimeout()

Determine if the response is a 408 Request Timeout

public isRequestTimeout() : bool|null
Return values
bool|null

isServerError()

Determine if the response is a server error

public isServerError() : bool|null
Return values
bool|null

isServiceUnavailable()

Determine if the response is a 503 Service Unavailable

public isServiceUnavailable() : bool|null
Return values
bool|null

isSuccess()

Determine if the response is a success

public isSuccess() : bool|null
Return values
bool|null

isTooManyRequests()

Determine if the response is a 429 Too Many Requests

public isTooManyRequests() : bool|null
Return values
bool|null

isUnauthorized()

Determine if the response is a 401 Unauthorized

public isUnauthorized() : bool|null
Return values
bool|null

isUnprocessableEntity()

Determine if the response is a 422 Unprocessable Entity

public isUnprocessableEntity() : bool|null
Return values
bool|null

isUnsupportedMediaType()

Determine if the response is a 415 Unsupported Media Type

public isUnsupportedMediaType() : bool|null
Return values
bool|null

render()

Render response as a raw string

public render() : string
Return values
string

send()

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
throws
Exception

        
On this page

Search results