Request extends Uri
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
- Constructor.
- __toString() : mixed
- createFormUrl() : object
- Get the scheme component of the URL.
- curl() : mixed
- Access to curl clients.
- filterPort() : string
- Filter port.
- filterQuery() : string
- Filter the Query uri.
- filterScheme() : string
- Filter the url scheme component.
- get() : bool|string
- Determine if header exists.
- getAuthority() : string
- Get the authority component of the URL.
- getBasePath() : string
- Get the basePath segment component of the URL.
- getBaseUrl() : string
- Get the fully qualified base URL.
- getBody() : array<string|int, mixed>
- Gets the body of the message.
- getContentType() : bool|array<string|int, mixed>
- Get a value from $_SERVER['CONTENT_TYPE'].
- getCookie() : mixed
- Get a value from $_COOKIE, or the whole array.
- getDelete() : mixed
- Get a value from DELETE query data, or the whole array.
- getDeterminedScheme() : string
- Get determined scheme.
- getDocumentRoot() : bool|array<string|int, mixed>
- Get a value from $_SERVER['DOCUMENT_ROOT'].
- getEnv() : mixed
- Get a value from $_ENV, or the whole array.
- getFiles() : mixed
- Get a value from $_FILES, or the whole array.
- getFragment() : string
- Get the fragment component of the URL.
- getHeader() : string
- Get the header by key/name.
- getHeaderLine() : array<string|int, mixed>
- Get a comma-separated string of the values for a single header.
- getHeaders() : void
- Get all message headers value.
- 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'].
- getParsedData() : mixed
- Get a value from parsed data, or the whole array.
- getPatch() : mixed
- Get a value from PATCH query data, or the whole array.
- getPath() : string
- Get the path component of the URL.
- getPort() : int
- Get the port component of the URL.
- getPost() : mixed
- Get a value from $_POST, or the whole array.
- getProtocolVersion() : string
- Get the protocol version.
- getPut() : mixed
- Get a value from PUT query data, or the whole array.
- getQuery() : mixed
- Get a value from $_GET, or the whole array.
- getQueryString() : bool|array<string|int, mixed>
- Get a value from $_SERVER['QUERY_STRING'].
- getRawData() : string
- Get the raw data.
- 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.
- getScheme() : string
- Get the scheme component of the URL.
- getSelf() : bool|array<string|int, mixed>
- Get a value from $_SERVER['PHP_SELF'].
- getServer() : mixed
- Get a value from $_SERVER, or the whole array.
- 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'].
- getSession() : mixed
- Get a value from $_SESSION, or the whole array.
- getUserInfo() : string
- Get the user information component of the URL.
- has() : bool
- Get the header by key.
- hasFiles() : bool
- Determine whether or not the request has FILES.
- hasHeader() : bool
- Determine headers is exists.
- isConnect() : bool
- Is this an CONNEXT request.
- isDelete() : bool
- Is this an DELETE request.
- isGet() : bool
- Is this an GET request.
- isHead() : bool
- Is this an HEAD request.
- isMethod() : bool
- Does this request use a given method?
- isOptions() : bool
- Is this an OPTIONS request.
- isPatch() : bool
- Is this an PATH request.
- isPost() : bool
- Is this an POST request.
- isPut() : bool
- Is this an PUT request.
- isSecure() : bool
- Return whether or not the request is secure.
- isTrace() : bool
- Is this an TRACE request.
- isXhr() : bool
- Is this an XHR request?
- 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.
- setUri() : object
- Set the Uri.
- update() : void
- Update existing header.
- withAddedHeader() : object
- Return an instance with the specified header appended with the given value.
- withBasePath() : object
- Return an instance with the specified basePath segment.
- withBody() : object
- Return an instance with the specified message body.
- withFragment() : object
- Return an instance with the specified fragment.
- withHeader() : object
- Return an instance with the provided value replacing the specified header.
- withHost() : object
- Return an instance with the specified host.
- withoutHeader() : object
- Return an instance without the specified header.
- withPath() : object
- Return an instance with the specified path.
- withPort() : object
- Return an instance with the specified port.
- withProtocolVersion() : void
- Return an instance with the specified HTTP protocol version.
- withQuery() : object
- Return an instance with the specified query.
- withUserInfo() : object
- Return an instance with the specified user information.
- parseData() : void
- Parse any data that came with the request.
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()
Constructor.
public
__construct() : mixed
Instantiate the request object
Tags
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —createFormUrl()
Get the scheme component of the URL.
public
createFormUrl((string) $url) : object
Parameters
- $url : (string)
-
valid url
Tags
Return values
object —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 —filterPort()
Filter port.
public
filterPort((int) $port) : string
Parameters
- $port : (int)
-
port number
Tags
Return values
string —filterQuery()
Filter the Query uri.
public
filterQuery((string) $query) : string
Parameters
- $query : (string)
-
query uri
Tags
Return values
string —filterScheme()
Filter the url scheme component.
public
filterScheme((string) $scheme) : string
Parameters
- $scheme : (string)
-
valid scheme
Tags
Return values
string —get()
Determine if header exists.
public
get((string) $key) : bool|string
Parameters
- $key : (string)
-
The header key
Tags
Return values
bool|string —getAuthority()
Get the authority component of the URL.
public
getAuthority() : string
Tags
Return values
string —getBasePath()
Get the basePath segment component of the URL.
public
getBasePath() : string
Tags
Return values
string —getBaseUrl()
Get the fully qualified base URL.
public
getBaseUrl() : string
Tags
Return values
string —getBody()
Gets the body of the message.
public
getBody() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getContentType()
Get a value from $_SERVER['CONTENT_TYPE'].
public
getContentType() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getCookie()
Get a value from $_COOKIE, or the whole array.
public
getCookie([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getDelete()
Get a value from DELETE query data, or the whole array.
public
getDelete([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getDeterminedScheme()
Get determined scheme.
public
getDeterminedScheme() : string
Tags
Return values
string —getDocumentRoot()
Get a value from $_SERVER['DOCUMENT_ROOT'].
public
getDocumentRoot() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getEnv()
Get a value from $_ENV, or the whole array.
public
getEnv([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getFiles()
Get a value from $_FILES, or the whole array.
public
getFiles([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getFragment()
Get the fragment component of the URL.
public
getFragment() : string
Tags
Return values
string —getHeader()
Get the header by key/name.
public
getHeader((string) $name) : string
Parameters
- $name : (string)
-
header field/key name
Tags
Return values
string —getHeaderLine()
Get a comma-separated string of the values for a single header.
public
getHeaderLine((string) $name) : array<string|int, mixed>
Parameters
- $name : (string)
-
header field/key name
Tags
Return values
array<string|int, mixed> —getHeaders()
Get all message headers value.
public
getHeaders() : void
Tags
Return values
void —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> —getParsedData()
Get a value from parsed data, or the whole array.
public
getParsedData([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getPatch()
Get a value from PATCH query data, or the whole array.
public
getPatch([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getPath()
Get the path component of the URL.
public
getPath() : string
Tags
Return values
string —getPort()
Get the port component of the URL.
public
getPort() : int
Tags
Return values
int —getPost()
Get a value from $_POST, or the whole array.
public
getPost([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getProtocolVersion()
Get the protocol version.
public
getProtocolVersion() : string
Tags
Return values
string —getPut()
Get a value from PUT query data, or the whole array.
public
getPut([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getQuery()
Get a value from $_GET, or the whole array.
public
getQuery([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getQueryString()
Get a value from $_SERVER['QUERY_STRING'].
public
getQueryString() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getRawData()
Get the raw data.
public
getRawData() : string
Tags
Return values
string —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 —getScheme()
Get the scheme component of the URL.
public
getScheme() : string
Tags
Return values
string —getSelf()
Get a value from $_SERVER['PHP_SELF'].
public
getSelf() : bool|array<string|int, mixed>
Tags
Return values
bool|array<string|int, mixed> —getServer()
Get a value from $_SERVER, or the whole array.
public
getServer([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
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> —getSession()
Get a value from $_SESSION, or the whole array.
public
getSession([(string) $key = null ]) : mixed
Parameters
- $key : (string) = null
Tags
Return values
mixed —getUserInfo()
Get the user information component of the URL.
public
getUserInfo() : string
Tags
Return values
string —has()
Get the header by key.
public
has((string) $key) : bool
Parameters
- $key : (string)
-
The header key
Tags
Return values
bool —hasFiles()
Determine whether or not the request has FILES.
public
hasFiles() : bool
Tags
Return values
bool —hasHeader()
Determine headers is exists.
public
hasHeader((string) $name) : bool
Parameters
- $name : (string)
-
header field/key name
Tags
Return values
bool —isConnect()
Is this an CONNEXT request.
public
isConnect() : bool
Tags
Return values
bool —isDelete()
Is this an DELETE request.
public
isDelete() : bool
Tags
Return values
bool —isGet()
Is this an GET request.
public
isGet() : bool
Tags
Return values
bool —isHead()
Is this an HEAD request.
public
isHead() : bool
Tags
Return values
bool —isMethod()
Does this request use a given method?
public
isMethod((string) $method) : bool
Parameters
- $method : (string)
-
HTTP method
Tags
Return values
bool —isOptions()
Is this an OPTIONS request.
public
isOptions() : bool
Tags
Return values
bool —isPatch()
Is this an PATH request.
public
isPatch() : bool
Tags
Return values
bool —isPost()
Is this an POST request.
public
isPost() : bool
Tags
Return values
bool —isPut()
Is this an PUT request.
public
isPut() : bool
Tags
Return values
bool —isSecure()
Return whether or not the request is secure.
public
isSecure() : bool
Tags
Return values
bool —isTrace()
Is this an TRACE request.
public
isTrace() : bool
Tags
Return values
bool —isXhr()
Is this an XHR request?
public
isXhr() : bool
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 —setUri()
Set the Uri.
public
setUri(mixed $scheme, mixed $host[, mixed $port = null ][, mixed $path = '/' ][, mixed $query = '' ][, mixed $fragment = '' ][, mixed $user = '' ][, mixed $password = '' ]) : object
Parameters
- $scheme : mixed
- $host : mixed
- $port : mixed = null
- $path : mixed = '/'
- $query : mixed = ''
- $fragment : mixed = ''
- $user : mixed = ''
- $password : mixed = ''
Tags
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
Tags
Return values
void —withAddedHeader()
Return an instance with the specified header appended with the given value.
public
withAddedHeader((string) $name, mixed $value) : object
Parameters
- $name : (string)
-
header field/key name (string) $value header value
- $value : mixed
Tags
Return values
object —withBasePath()
Return an instance with the specified basePath segment.
public
withBasePath(mixed $basePath) : object
Parameters
- $basePath : mixed
Tags
Return values
object —withBody()
Return an instance with the specified message body.
public
withBody((mixed) $body) : object
Parameters
- $body : (mixed)
-
Body
Tags
Return values
object —withFragment()
Return an instance with the specified fragment.
public
withFragment((string) $fragment) : object
Parameters
- $fragment : (string)
-
valid fragment
Tags
Return values
object —withHeader()
Return an instance with the provided value replacing the specified header.
public
withHeader((string) $name, mixed $value) : object
Parameters
- $name : (string)
-
header field/key name (string) $value header value
- $value : mixed
Tags
Return values
object —withHost()
Return an instance with the specified host.
public
withHost((string) $host) : object
Parameters
- $host : (string)
-
valid host
Tags
Return values
object —withoutHeader()
Return an instance without the specified header.
public
withoutHeader((string) $name) : object
Parameters
- $name : (string)
-
header field/key name
Tags
Return values
object —withPath()
Return an instance with the specified path.
public
withPath((string) $path) : object
Parameters
- $path : (string)
-
valid path
Tags
Return values
object —withPort()
Return an instance with the specified port.
public
withPort((string) $port) : object
Parameters
- $port : (string)
-
valid port
Tags
Return values
object —withProtocolVersion()
Return an instance with the specified HTTP protocol version.
public
withProtocolVersion((string) $version) : void
Parameters
- $version : (string)
-
valid Protocol version
Tags
Return values
void —withQuery()
Return an instance with the specified query.
public
withQuery((string) $query) : object
Parameters
- $query : (string)
-
valid query
Tags
Return values
object —withUserInfo()
Return an instance with the specified user information.
public
withUserInfo((string) $user[, mixed $password = null ]) : object
Parameters
- $user : (string)
-
username (string) $password password
- $password : mixed = null
Tags
Return values
object —parseData()
Parse any data that came with the request.
protected
parseData() : void