Flexible input handler for request inputs (POST, GET, PUT, DELETE, REQUEST, FILES, COOKIE) using filter_var()
Flexible input handler for request inputs (POST, GET, PUT, DELETE, REQUEST, FILES, COOKIE) using filter_var(). It's safe to use with recursive array (ie: will filter each item in sub-arrays)., (*1)
Via composer, (*2)
{ "require": { "innobrig/flex-input": "^1.0" } }, (*3)
<?php, (*4)
use InnoBrig\FlexInput\Input;, (*5)
Retrieving the entire GET array:, (*6)
$value = Input::fromGet ();, (*7)
Retrieving a specific item from GET:, (*8)
$value = Input::fromGet ('key');, (*9)
Retrieving a specific item from GET while specifying a default value to be returned if the requested item is not found:, (*10)
$value = Input::fromGet ('key', $defaultValue);, (*11)
Retrieving a specific item from POST while specifying default, filter and args, (*12)
$value = Input::fromPost ('key', $defaultValue, FILTER_SANITIZE_STRING, array(FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));, (*13)
Internally the PHP function filter_var() is used; consult the PHP docs for the various options which are supported., (*14)
Note: per default, values retrieved from input have trim() applied to them., (*15)