Documentation

Redirect extends HTTP

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()  : void
Send redirect.
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
since
1.0.0

$body

Response body.

protected string $body = null
Tags
since
1.0.0

$code

Protocol.

protected int $code = null
Tags
since
1.0.0

COOKIE array.

protected array<string|int, mixed> $cookie = []
Tags
since
1.0.0

$delete

DELETE array.

protected array<string|int, mixed> $delete = []
Tags
since
1.0.0

$env

ENV array.

protected array<string|int, mixed> $env = []
Tags
since
1.0.0

$files

FILES array.

protected array<string|int, mixed> $files = []
Tags
since
1.0.0

$fragment

Uri fragment string (without "#" prefix).

protected string $fragment = ''
Tags
since
1.0.0

$get

GET array.

protected array<string|int, mixed> $get = []
Tags
since
1.0.0

$headers

Headers.

protected array<string|int, mixed> $headers = []
Tags
since
1.0.0

$host

Uri host.

protected string $host = ''
Tags
since
1.0.0

$parsedData

Parsed data.

protected mixed $parsedData = null
Tags
since
1.0.0

$password

Uri password.

protected string $password = ''
Tags
since
1.0.0

$patch

PATCH array.

protected array<string|int, mixed> $patch = []
Tags
since
1.0.0

$path

Uri path.

protected string $path = ''
Tags
since
1.0.0

$port

Uri port number.

protected null|int $port
Tags
since
1.0.0

$post

POST array.

protected array<string|int, mixed> $post = []
Tags
since
1.0.0

$put

PUT array.

protected array<string|int, mixed> $put = []
Tags
since
1.0.0

$query

Uri query string (without "?" prefix).

protected string $query = ''
Tags
since
1.0.0

$rawData

Raw data.

protected string $rawData = null
Tags
since
1.0.0

$reasonPhrase

reasonPhrase.

protected string $reasonPhrase = null
Tags
since
1.0.0

$requestUri

Request URI.

protected string $requestUri = null
Tags
since
1.0.0

$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
since
1.0.0

$scheme

Uri scheme (without "://" suffix).

protected string $scheme = ''
Tags
since
1.0.0

$segments

Path segments.

protected array<string|int, mixed> $segments = []
Tags
since
1.0.0

$server

SERVER array.

protected array<string|int, mixed> $server = []
Tags
since
1.0.0

$session

SESSION array.

protected array<string|int, mixed> $session = []
Tags
since
1.0.0

$user

Uri user.

protected string $user = ''
Tags
since
1.0.0

$validProtocolVersions

Valid protocol versions.

protected static array<string|int, mixed> $validProtocolVersions = ['1.0' => true, '1.1' => true, '2.0' => true, '2' => true]
Tags
since
1.0.0

$version

HTTP version.

protected string $version = '1.1'
Tags
since
1.0.0

Methods

__construct()

Send redirect.

public __construct((string) $url[, (int) $code = '302' ][, (mixed) $version = '1.1' ]) : void
Parameters
$url : (string)
$code : (int) = '302'
$version : (mixed) = '1.1'
Tags
since
1.0.0
Return values
void

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
since
1.0.0
Return values
mixed

get()

Determine if header exists.

public get((string) $key) : bool|string
Parameters
$key : (string)

The header key

Tags
since
1.0.0
Return values
bool|string

getContentType()

Get a value from $_SERVER['CONTENT_TYPE'].

public getContentType() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getDocumentRoot()

Get a value from $_SERVER['DOCUMENT_ROOT'].

public getDocumentRoot() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getHost()

Get a value from $_SERVER['HTTP_HOST'].

public getHost() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

gethttp()

Get a value from $_SERVER['HTTP'].

public gethttp() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

gethttps()

Get a value from $_SERVER['HTTPS'].

public gethttps() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getQueryString()

Get a value from $_SERVER['QUERY_STRING'].

public getQueryString() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getReference()

Get a value from $_SERVER['HTTP_REFERER'].

public getReference() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getRequestMethod()

Get a value from $_SERVER['REQUEST_METHOD'].

public getRequestMethod() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getRequestUrl()

Get a value from $_SERVER['REQUEST_URI'].

public getRequestUrl() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

gets()

Get all headers.

public gets() : bool|string
Tags
since
1.0.0
Return values
bool|string

getSelf()

Get a value from $_SERVER['PHP_SELF'].

public getSelf() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getServerName()

Get a value from $_SERVER['SERVER_NAME'].

public getServerName() : bool|array<string|int, mixed>
Tags
since
1.0.0
Return values
bool|array<string|int, mixed>

getServerPort()

Get a value from $_SERVER['SERVER_PORT'].

public getServerPort() : bool|array<string|int, mixed>
Tags
since
1.0.0
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
since
1.0.0
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
since
1.0.0
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
since
1.0.0
Return values
void

sendHeaders()

Send headers.

public sendHeaders() : void
Tags
since
1.0.0
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
since
1.0.0
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

Tags
since
1.0.0
Return values
void

Search results