HTTP Requests

Will auto protect agains XXS!

Access request class

$this->modal()->request();

Usage

$this->modal()->request()->[REQUEST_TYPE]->[SETTINGS]->[SETTINGS]->val();
Request types
$this->modal()->request()->get(string/array);
$this->modal()->request()->post(string/array);
$this->modal()->request()->array(array) // Specify custom data;
Settings

Se all chaining methods in settings list »

Examples

Allways start with one of (get, post or array). They work exactly the same so I will only show examples with get bellow.

Get all HTTP requests

Will return all HTTP requests from URL as array

$this->modal()->request()->get()->val();

Query string: id=1&permalink=test&type=page&lorem=ok
Result: [id => 1, permalink => test, type => page, lorem => ok]

Whitelist: Get one HTTP request

Will return one HTTP request from URL as string

$this->modal()->request()->get("id")->val();

Query string: id=1&permalink=test&type=page&lorem=ok
Result: 1

Whitelist: Get multiple specified HTTP request

Will return multiple and specified HTTP request from URL as array

$this->modal()->request()->get(["id", "permalink", "type"])->val();

Query string: id=1&permalink=test&type=page&lorem=ok
Result: [id => 1, permalink => test, type => page]

Format return values

Will format values. Click here to get all settings »

$this->modal()->request()->get("permalink")->friendly()->xxs(false)->val();

Query string: permalink=Hello world
Result: hello-world

Complete settings list

Get current REQUEST_METHOD
@return string get, post, ...
method()
XXS is on every query item by default. Use this method if you want to turn off XXS on all or specify and array key
@param boolean $bool bool/array
@return self (chaining)
xxs($bool = true)
Use this method if you want to turn on friendly url on all items or specify and array key
@param boolean $bool bool/array
@return self (chaining)
friendly($bool = true)
Use this method if you want to strip all HTML on all items or specify and array key
@param boolean $bool bool/array
@return self (chaining)
stripTags($bool = true)
Return request as array else auto process arrays to json
@param boolean $bool bool/array
@return self (chaining)
arr($bool = true)
Navigate the Request array.
Example: @key: "a,b", will select $_POST['a']['b']
@param string $key comma seperated string (NO SPACES)
@return self (chaining)
toString($key)
SHOTCUT @toString: Navigate the Request array.
Example: @key: "a,b", will select $_POST['a']['b']
@param string $key comma seperated string (NO SPACES)
@return self (chaining)
loc($key)
Json encode array
@return self (chaining)
json($bool = true)
Get current query request
@param boolean $key bool/string key
@return [type] [description]
getRequest($key = false)
Return cleaned query request
@param bool/string $xxsOrCall If you want to exclude XXS on a whole array chunk
@return array
val($xxsOrCall = NULL)
DEPRECATED: Access symfony instance
Had some strange bugs and not logical enough.
@return instance
request()