class Http extends Request_Abstract (View source)

Constants

SCHEME_HTTP

SCHEME_HTTPS

Properties

string $module from  Request_Abstract
string $controller from  Request_Abstract
string $action from  Request_Abstract
string $method from  Request_Abstract
protected array $params from  Request_Abstract
protected string $language from  Request_Abstract
protected Exception $_exception from  Request_Abstract
protected string $_base_uri from  Request_Abstract
protected string $uri from  Request_Abstract
protected string $dispatched from  Request_Abstract
protected string $routed from  Request_Abstract

Methods

bool
isGet()

No description

bool
isPost()

No description

bool
isPut()

No description

bool
isHead()

No description

bool
isOptions()

No description

bool
isCli()

No description

bool
isDispatched()

No description

bool
isRouted()

No description

bool
isXmlHttpRequest()

Check the request whether it is a Ajax Request

mixed
getServer(string $name = null, mixed $default = null)

Retrieve $_SERVER variable

mixed
getEnv(string $name = null, mixed $default = null)

Retrieve $_ENV variable

mixed
getParam(string $name, mixed $default = null)

No description

array
getParams()

No description

getException()

No description

string
getModuleName()

No description

string
getControllerName()

No description

string
getActionName()

No description

setParam(string|array $name, string $value = null)

No description

setModuleName(string $module)

No description

setControllerName(string $controller)

No description

setActionName(string $action)

No description

string
getMethod()

No description

string
getLanguage()

No description

bool
setBaseUri(string $uri)

Set base URI, base URI is used when doing routing, in routing phase request URI is used to route a request, while base URI is used to skip the leading part(base URI) of request URI. That is, if comes a request with request URI a/b/c, then if you set base URI to "a/b", only "/c" will be used in routing phase.


Note:

generally, you don't need to set this, Yaf will determine it automatically.

string
getBaseUri()

No description

string
getRequestUri()

No description

setRequestUri(string $uri)

No description

bool
setDispatched()

Set request as dispatched

setRouted()

Set request as routed

mixed
getQuery(string $name = null, mixed $default = null)

Retrieve $_GET variable

mixed
getRequest(string $name = null, mixed $default = null)

Retrieve $_REQUEST variable

mixed
getPost(string $name = null, mixed $default = null)

Retrieve $_POST variable

mixed
getCookie(string $name = null, mixed $default = null)

Retrieve $_COOKIE variable

mixed
getFiles(string $name = null, mixed $default = null)

Retrieve $_FILES variable

mixed
get(string $name, string $default = null)

Retrieve variable from client, this method will search the name in $_REQUEST params, if the name is not found, then will search in $_POST, $_GET, $_COOKIE, $_SERVER

__construct(string $request_uri, string $base_uri)

No description

Details

bool isGet()

No description

Return Value

bool

bool isPost()

No description

Return Value

bool

bool isPut()

No description

Return Value

bool

bool isHead()

No description

Return Value

bool

bool isOptions()

No description

Return Value

bool

bool isCli()

No description

Return Value

bool

bool isDispatched()

No description

Return Value

bool

bool isRouted()

No description

Return Value

bool

bool isXmlHttpRequest()

Check the request whether it is a Ajax Request


Note:

This method depends on the request header: HTTP_X_REQUESTED_WITH, some Javascript library doesn't set this header while doing Ajax request

Return Value

bool false

mixed getServer(string $name = null, mixed $default = null)

Retrieve $_SERVER variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getEnv(string $name = null, mixed $default = null)

Retrieve $_ENV variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getParam(string $name, mixed $default = null)

No description

Parameters

string $name
mixed $default

Return Value

mixed

array getParams()

No description

Return Value

array

Exception getException()

No description

Return Value

Exception

string getModuleName()

No description

Return Value

string

string getControllerName()

No description

Return Value

string

string getActionName()

No description

Return Value

string

Request_Abstract|bool setParam(string|array $name, string $value = null)

No description

Parameters

string|array $name

the variable name, or an array of key=>value pairs

string $value

Return Value

Request_Abstract|bool

Request_Abstract|bool setModuleName(string $module)

No description

Parameters

string $module

Return Value

Request_Abstract|bool

Request_Abstract|bool setControllerName(string $controller)

No description

Parameters

string $controller

Return Value

Request_Abstract|bool

Request_Abstract|bool setActionName(string $action)

No description

Parameters

string $action

Return Value

Request_Abstract|bool

string getMethod()

No description

Return Value

string

string getLanguage()

No description

Return Value

string

bool setBaseUri(string $uri)

Set base URI, base URI is used when doing routing, in routing phase request URI is used to route a request, while base URI is used to skip the leading part(base URI) of request URI. That is, if comes a request with request URI a/b/c, then if you set base URI to "a/b", only "/c" will be used in routing phase.


Note:

generally, you don't need to set this, Yaf will determine it automatically.

Parameters

string $uri

base URI

Return Value

bool

string getBaseUri()

No description

Return Value

string

string getRequestUri()

No description

Return Value

string

setRequestUri(string $uri)

Since: 2.1.0

No description

Parameters

string $uri

request URI

bool setDispatched()

Set request as dispatched

Return Value

bool

Request_Abstract|bool setRouted()

Set request as routed

Return Value

Request_Abstract|bool

mixed getQuery(string $name = null, mixed $default = null)

Retrieve $_GET variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getRequest(string $name = null, mixed $default = null)

Retrieve $_REQUEST variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getPost(string $name = null, mixed $default = null)

Retrieve $_POST variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getCookie(string $name = null, mixed $default = null)

Retrieve $_COOKIE variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed getFiles(string $name = null, mixed $default = null)

Retrieve $_FILES variable

Parameters

string $name

the variable name, if not provided returns all

mixed $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

mixed get(string $name, string $default = null)

Retrieve variable from client, this method will search the name in $_REQUEST params, if the name is not found, then will search in $_POST, $_GET, $_COOKIE, $_SERVER

Parameters

string $name

the variable name

string $default

if this parameter is provide, this will be returned if the variable can not be found

Return Value

mixed

__construct(string $request_uri, string $base_uri)

No description

Parameters

string $request_uri
string $base_uri