PHP Class Bluz\Proxy\Request

Example of usage use Bluz\Proxy\Request; Request::getParam('foo');
See also: Zend\Diactoros\RequestTrait::getUri()
Author: Anton Shevchuk
Inheritance: use trait ProxyTrait
Show file Open project: bluzphp/framework Class Usage Examples

Public Methods

Method Description
getAccept ( array $allowTypes = [] ) : string Get Accept MIME Type
getClientIp ( boolean $checkProxy = true ) : string Get the client's IP address
getController ( ) : string Get controller
getCookie ( string $key = null, string $default = null ) : string Retrieve a member of the $_COOKIE super global
getEnv ( string $key = null, string $default = null ) : string Retrieve a member of the $_ENV super global
getFile ( string $name ) : UploadedFile Get uploaded file
getHeader ( string $header, mixed $default = null ) : string Search for a header value
getMethod ( ) : string Get method
getModule ( ) : string Get module
getParam ( string $key, null $default = null ) : mixed Access values contained in the superglobals as public members Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV
getParams ( ) : array Get all params from GET and POST or PUT
getServer ( string $key = null, string $default = null ) : string Retrieve a member of the $_SERVER super global
isCli ( ) : boolean Check CLI
isDelete ( ) : boolean Is this a DELETE method request?
isGet ( ) : boolean Is this a GET method request?
isHttp ( ) : boolean Check HTTP
isPost ( ) : boolean Is this a POST method request?
isPut ( ) : boolean Is this a PUT method request?
isXmlHttpRequest ( ) : boolean Is the request a Javascript XMLHttpRequest?

Protected Methods

Method Description
initInstance ( ) Init instance

Method Details

getAccept() public static method

Get Accept MIME Type
public static getAccept ( array $allowTypes = [] ) : string
$allowTypes array
return string

getClientIp() public static method

Get the client's IP address
public static getClientIp ( boolean $checkProxy = true ) : string
$checkProxy boolean
return string

getController() public static method

Get controller
public static getController ( ) : string
return string

getCookie() public static method

If no $key is passed, returns the entire $_COOKIE array.
public static getCookie ( string $key = null, string $default = null ) : string
$key string
$default string Default value to use if key not found
return string Returns null if key does not exist

getEnv() public static method

If no $key is passed, returns the entire $_ENV array.
public static getEnv ( string $key = null, string $default = null ) : string
$key string
$default string Default value to use if key not found
return string Returns null if key does not exist

getFile() public static method

Get uploaded file
public static getFile ( string $name ) : UploadedFile
$name string
return Zend\Diactoros\UploadedFile

getHeader() public static method

Search for a header value
public static getHeader ( string $header, mixed $default = null ) : string
$header string
$default mixed
return string

getMethod() public static method

Get method
public static getMethod ( ) : string
return string

getModule() public static method

Get module
public static getModule ( ) : string
return string

getParam() public static method

Access values contained in the superglobals as public members Order of precedence: 1. GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV
public static getParam ( string $key, null $default = null ) : mixed
$key string
$default null
return mixed

getParams() public static method

Get all params from GET and POST or PUT
public static getParams ( ) : array
return array

getServer() public static method

If no $key is passed, returns the entire $_SERVER array.
public static getServer ( string $key = null, string $default = null ) : string
$key string
$default string Default value to use if key not found
return string Returns null if key does not exist

initInstance() protected static method

Init instance
protected static initInstance ( )

isCli() public static method

Check CLI
public static isCli ( ) : boolean
return boolean

isDelete() public static method

Is this a DELETE method request?
public static isDelete ( ) : boolean
return boolean

isGet() public static method

Is this a GET method request?
public static isGet ( ) : boolean
return boolean

isHttp() public static method

Check HTTP
public static isHttp ( ) : boolean
return boolean

isPost() public static method

Is this a POST method request?
public static isPost ( ) : boolean
return boolean

isPut() public static method

Is this a PUT method request?
public static isPut ( ) : boolean
return boolean

isXmlHttpRequest() public static method

Is the request a Javascript XMLHttpRequest?
public static isXmlHttpRequest ( ) : boolean
return boolean