Class Request
Core request: - linear request url parsing from $_SERVER into local properties describing url sections - params reading from $_GET/$_POST or direct input (in JSON or in query string) - params cleaning by developer rules
public static
|
#
GetInstance( array & $server, array & $get, array & $post )
Get everytime new instance of http request, global variables should be changed and injected here to get different request object from currently called real request. |
public
|
#
__construct( array & $server, array & $get, array & $post )
Get everytime new instance of http request, global variables should be changed and injected here to get different request object from currently called real request. |
public
mixed|
|
#
__call( string $rawName, array $arguments = array() )
Sets any custom property ('PropertyName') by $request->SetPropertyName('value'), which is not necessary to define previously or gets previously defined property ('PropertyName') by $request->GetPropertyName(); Throws exception if no property defined by get call or if virtual call begins with anything different from 'set' or 'get'. This method returns custom value for get and $request instance for set. |
public
mixed
|
|
public
|
|
public
|
|
public
string
|
|
public
boolean
|
#
IsAppRequest( )
Return boolean flag if request target is anything different than 'Controller:Asset' |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
#
initHttpParams( )
Initialize params from global $_GET and (global $_POST or direct 'php://input'). |
protected
|
|
protected
|
|
protected
|
string |
PROTOCOL_HTTP
|
#
'http:'
|
string |
PROTOCOL_HTTPS
|
#
'https:'
|
string |
METHOD_GET
|
#
'GET'
|
string |
METHOD_POST
|
#
'POST'
|
public
string
|
$Lang
Language international code, lowercase, not used by default. To use this variable - install \MvcCore\Router extension \MvcCoreExt\Router\Lang Example: 'en' |
#
''
|
public
string
|
$Locale
Country/locale code, uppercase, not used by default. To use this variable - install \MvcCore\Router extension \MvcCoreExt\Router\Locale Example: 'US' |
#
''
|
public
string
|
$Protocol
Http protocol: 'http:' | 'https:' Example: 'http:' |
#
''
|
public
string
|
$ServerName
Application server name - domain without any port. Example: 'localhost' |
#
''
|
public
string
|
$Host
Application host with port if there is any. Example: 'localhost:88' |
#
''
|
public
string
|
$Port
Http port parsed by parse_url(). Example: '88' |
#
''
|
public
string
|
$Path
Requested path in from application root (if mod_rewrite enabled), never with query string. Example: '/products/page/2' |
#
''
|
public
string
|
$Query
Uri query string without question mark. Example: 'param-1=value-1¶m-2=value-2¶m-3[]=value-3-a¶m-3[]=value-3-b' |
#
''
|
public
mixed
|
$Fragment
Uri fragment parsed by parse_url() Example: '#any-sublink-path' |
#
''
|
public
string
|
$ScriptName
Php requested script name path from application root. Example: '/index.php' |
#
''
|
public
string
|
$AppRoot
Application root path in hard drive: C:/www/my/development/direcotry/www |
#
''
|
public
string
|
$BasePath
Base app directory path after domain, if application is placed in domain subdirectory Example: full url: 'http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string' base path: '/my/development/direcotry/www' |
#
''
|
public
string
|
$RequestPath
Request path after domain with possible query string Example: '/requested/path/after/app/root?with=possible&query=string' |
#
''
|
public
string
|
$DomainUrl
Url to requested domain and possible port. Example: 'http://domain:88' |
#
''
|
public
string
|
$BaseUrl
Base url to application root. Example: 'http://domain:88/my/development/direcotry/www' |
#
''
|
public
string
|
$RequestUrl
Request url including scheme, domain, port, path, without any query string Example: ''http://localhost:88/my/development/direcotry/www/requested/path/after/domain' |
#
''
|
public
string
|
$FullUrl
Request url including scheme, domain, port, path and with query string Example: 'http://localhost:88/my/development/direcotry/www/requested/path/after/domain?with=possible&query=string' |
#
''
|
public
string
|
$Method
Http method (uppercase) - GET, POST, PUT, HEAD... Example: 'GET' |
#
''
|
public
string
|
$Referer
Referer url if any, safely readed by: filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL); Example: 'GET' |
#
''
|
public
array
|
$Params
Request params array, with keys defined in route or by query string, always with controller and action keys completed by router. Example: array('controller' => 'default', 'action' => 'default', 'user' => "' OR 1=1;-- with raw danger value!"); To get safe param value - use: $request->GetParam('user', 'a-zA-Z0-9'); |
#
array()
|
public
string
|
$MediaSiteKey
Media site key - 'full' | 'tablet' | 'mobile' To use this variable - install \MvcCore\Router extension \MvcCoreExt\Router\Media Example: 'full' |
#
''
|
protected
array
|
$serverGlobals
Content of $_SERVER global variable |
#
array()
|
protected
array
|
$getGlobals
Content of $_GET global variable |
#
array()
|
protected
array
|
$postGlobals
Content of $_POST global variable |
#
array()
|
protected
array
|
$indexScriptName
Requested script name |
#
''
|
protected
mixed
|
$appRequest
Request flag if request targets internal package asset or not, - 0 - request is Controller:Asset call for internal package asset - 1 - request is classic application request |
#
-1
|