This helper serves two purposes:
- It pre-processes global input data for security.
- It provides some helper methods for fetching input data and pre-processing it.
This helper let to you fetch POST, GET, COOKIE or SERVER items. The main advantage of using the provided methods rather than fetching an item directly $_POST['something']
is that the methods will check to see if the item is set and return NULL if not. This lets you conveniently use data without having to test whether an item exists first. In other words, normally you might do something like this:
$something = isset($_POST['something']) ? $_POST['something'] : 'default value';
With this helper methods you can simply do this:
$something = Request::post('something', 'default value');
Please read our Wiki for more detailed information, advanced usage and shorthands.
You'll need to use an autoloader with this. Ideally, this would be Composer.
From the command line:
composer require jp-toolkit/request-helper
Have a bug? Please create an issue on GitHub at https://github.com/jprieton/jp-toolkit-request-helper/issues)