HTTP extends Headers Uses StatusCode, ValidProtocolVersions
Table of Contents
- $basePath : string
- Base path.
- $body : string
- Response body.
- $code : int
- Protocol.
- $cookie : array<string|int, mixed>
- COOKIE array.
- $delete : array<string|int, mixed>
- DELETE array.
- $env : array<string|int, mixed>
- ENV array.
- $files : array<string|int, mixed>
- FILES array.
- $fragment : string
- Uri fragment string (without "#" prefix).
- $get : array<string|int, mixed>
- GET array.
- $headers : array<string|int, mixed>
- Headers.
- $host : string
- Uri host.
- $parsedData : mixed
- Parsed data.
- $password : string
- Uri password.
- $patch : array<string|int, mixed>
- PATCH array.
- $path : string
- Uri path.
- $port : null|int
- Uri port number.
- $post : array<string|int, mixed>
- POST array.
- $put : array<string|int, mixed>
- PUT array.
- $query : string
- Uri query string (without "?" prefix).
- $rawData : string
- Raw data.
- $reasonPhrase : string
- reasonPhrase.
- $requestUri : string
- Request URI.
- $responseCodes : array<string|int, mixed>
- Response codes & messages.
- $scheme : string
- Uri scheme (without "://" suffix).
- $segments : array<string|int, mixed>
- Path segments.
- $server : array<string|int, mixed>
- SERVER array.
- $session : array<string|int, mixed>
- SESSION array.
- $user : string
- Uri user.
- $validProtocolVersions : array<string|int, mixed>
- Valid protocol versions.
- $version : string
- HTTP version.
- __construct() : mixed
- __construct.
- curl() : mixed
- Access to curl clients.
- get() : bool|string
- Determine if header exists.
- getContentType() : bool|array<string|int, mixed>
- Get a value from $_SERVER['CONTENT_TYPE'].
- getDocumentRoot() : bool|array<string|int, mixed>
- Get a value from $_SERVER['DOCUMENT_ROOT'].
- getHost() : bool|array<string|int, mixed>
- Get a value from $_SERVER['HTTP_HOST'].
- gethttp() : bool|array<string|int, mixed>
- Get a value from $_SERVER['HTTP'].
- gethttps() : bool|array<string|int, mixed>
- Get a value from $_SERVER['HTTPS'].
- getQueryString() : bool|array<string|int, mixed>
- Get a value from $_SERVER['QUERY_STRING'].
- getReference() : bool|array<string|int, mixed>
- Get a value from $_SERVER['HTTP_REFERER'].
- getRequestMethod() : bool|array<string|int, mixed>
- Get a value from $_SERVER['REQUEST_METHOD'].
- getRequestUrl() : bool|array<string|int, mixed>
- Get a value from $_SERVER['REQUEST_URI'].
- gets() : bool|string
- Get all headers.
- getSelf() : bool|array<string|int, mixed>
- Get a value from $_SERVER['PHP_SELF'].
- getServerName() : bool|array<string|int, mixed>
- Get a value from $_SERVER['SERVER_NAME'].
- getServerPort() : bool|array<string|int, mixed>
- Get a value from $_SERVER['SERVER_PORT'].
- has() : bool
- Get the header by key.
- normalizeKey() : string
- Normalize header name.
- remove() : void
- Remove the header by key.
- send() : void
- Send response.
- sendHeaders() : void
- Send headers.
- setHeader() : void
- append new header.
- setHeaders() : object
- Set response headers.
- update() : void
- Update existing header.
Properties
$basePath
Base path.
protected
string
$basePath
= null
Tags
$body
Response body.
protected
string
$body
= null
Tags
$code
Protocol.
protected
int
$code
= null
Tags
$cookie
COOKIE array.
protected
array<string|int, mixed>
$cookie
= []
Tags
$delete
DELETE array.
protected
array<string|int, mixed>
$delete
= []
Tags
$env
ENV array.
protected
array<string|int, mixed>
$env
= []
Tags
$files
FILES array.
protected
array<string|int, mixed>
$files
= []
Tags
$fragment
Uri fragment string (without "#" prefix).
protected
string
$fragment
= ''
Tags
$get
GET array.
protected
array<string|int, mixed>
$get
= []
Tags
$headers
Headers.
protected
array<string|int, mixed>
$headers
= []
Tags
$host
Uri host.
protected
string
$host
= ''
Tags
$parsedData
Parsed data.
protected
mixed
$parsedData
= null
Tags
$password
Uri password.
protected
string
$password
= ''
Tags
$patch
PATCH array.
protected
array<string|int, mixed>
$patch
= []
Tags
$path
Uri path.
protected
string
$path
= ''
Tags
$port
Uri port number.
protected
null|int
$port
Tags
$post
POST array.
protected
array<string|int, mixed>
$post
= []
Tags
$put
PUT array.
protected
array<string|int, mixed>
$put
= []
Tags
$query
Uri query string (without "?" prefix).
protected
string
$query
= ''
Tags
$rawData
Raw data.
protected
string
$rawData
= null
Tags
$reasonPhrase
reasonPhrase.
protected
string
$reasonPhrase
= null
Tags
$requestUri
Request URI.
protected
string
$requestUri
= null
Tags
$responseCodes
Response codes & messages.
protected
static array<string|int, mixed>
$responseCodes
= [
// Informational 1xx
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
// Success 2xx
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
208 => 'Already Reported',
226 => 'IM Used',
// Redirection 3xx
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
306 => 'Switch Proxy',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect',
// Client Error 4xx
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Payload Too Large',
414 => 'URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
421 => 'Misdirected Request',
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',
451 => 'Unavailable For Legal Reasons',
// Server Error 5xx
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
508 => 'Loop Detected',
509 => 'Bandwidth Limit Exceeded',
510 => 'Not Extended',
511 => 'Network Authentication Required',
]
Tags
$scheme
Uri scheme (without "://" suffix).
protected
string
$scheme
= ''
Tags
$segments
Path segments.
protected
array<string|int, mixed>
$segments
= []
Tags
$server
SERVER array.
protected
array<string|int, mixed>
$server
= []
Tags
$session
SESSION array.
protected
array<string|int, mixed>
$session
= []
Tags
$user
Uri user.
protected
string
$user
= ''
Tags
$validProtocolVersions
Valid protocol versions.
protected
static array<string|int, mixed>
$validProtocolVersions
= ['1.0' => true, '1.1' => true, '2.0' => true, '2' => true]
Tags
$version
HTTP version.
protected
string
$version
= '1.1'
Tags
Methods
__construct()
__construct.
public
__construct() : mixed
Tags
Return values
mixed —curl()
Access to curl clients.
public
curl((string) $url[, mixed $method = 'GET' ][, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $url : (string)
-
(string) $method (array) $options
- $method : mixed = 'GET'
- $options : array<string|int, mixed> = null
Tags
Return values
mixed —get()
Determine if header exists.
public
get((string) $key) : bool|string
Parameters
- $key : (string)
-
The header key
Tags
Return values
bool|string —getContentType()
Get a value from $_SERVER['CONTENT_TYPE'].
public
getContentType() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getDocumentRoot()
Get a value from $_SERVER['DOCUMENT_ROOT'].
public
getDocumentRoot() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getHost()
Get a value from $_SERVER['HTTP_HOST'].
public
getHost() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —gethttp()
Get a value from $_SERVER['HTTP'].
public
gethttp() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —gethttps()
Get a value from $_SERVER['HTTPS'].
public
gethttps() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getQueryString()
Get a value from $_SERVER['QUERY_STRING'].
public
getQueryString() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getReference()
Get a value from $_SERVER['HTTP_REFERER'].
public
getReference() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getRequestMethod()
Get a value from $_SERVER['REQUEST_METHOD'].
public
getRequestMethod() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getRequestUrl()
Get a value from $_SERVER['REQUEST_URI'].
public
getRequestUrl() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —gets()
Get all headers.
public
gets() : bool|string
Tags
Return values
bool|string —getSelf()
Get a value from $_SERVER['PHP_SELF'].
public
getSelf() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getServerName()
Get a value from $_SERVER['SERVER_NAME'].
public
getServerName() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getServerPort()
Get a value from $_SERVER['SERVER_PORT'].
public
getServerPort() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —has()
Get the header by key.
public
has((string) $key) : bool
Parameters
- $key : (string)
-
The header key
Tags
Return values
bool —normalizeKey()
Normalize header name.
public
normalizeKey((string) $key) : string
Parameters
- $key : (string)
-
The case-insensitive header name
Return values
string —remove()
Remove the header by key.
public
remove((string) $key) : void
Parameters
- $key : (string)
-
The header key
Tags
Return values
void —send()
Send response.
public
send([(int) $code = null ][, (array) $headers = null ][, (bool) $compress = false ]) : void
Parameters
- $code : (int) = null
-
Status code.
- $headers : (array) = null
-
Headers.
- $compress : (bool) = false
-
Content compression.
Tags
Return values
void —sendHeaders()
Send headers.
public
sendHeaders() : void
Tags
Return values
void —setHeader()
append new header.
public
setHeader((string) $key, (string) $value) : void
Parameters
- $key : (string)
-
The header key.
- $value : (string)
-
The header value.
Tags
Return values
void —setHeaders()
Set response headers.
public
setHeaders((array) $headers) : object
Parameters
- $headers : (array)
Return values
object —update()
Update existing header.
public
update((string) $key, (string) $value) : void
Parameters
- $key : (string)
-
The header key
- $value : (string)
-
The new header value