| Recommend this page to a friend! | 
|  Download | 
| Info | Documentation |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 63 | All time:  10,443 This week: 206  | ||||
| Version | License | PHP version | Categories | |||
| mezon-request 1.0 | MIT/X Consortium ... | 5 | HTTP, PHP 5, Security | 
This class will help you to fetch data from $_POST and $_GET arrays.
Just print in console
composer require mezon/request
And that's all )
More information can be found here:
The firs steps are quite simple
var_dump(Request::getParam('some-param', 'default'));// will be outputted 'default'
$_GET['some-param'] = 'some-value';
var_dump(Request::getParam('some-param'));// will be outputted 'some-value'
In case you have the same parameters in $_GET, $_POST and other global arrays, then they will be prioritized in this way:
For example:
$_GET['some-param'] = 'get-value';
$_POST['some-param'] = 'post-value';
var_dump(Request::getParam('some-param'));// will be outputted 'post value'
You can pass your Router object to this class and fetch parameters for non-static routes:
Request::registerRouter(<your Mezon\Router object>);
There are a way to fetch security token from headers:
For example if you will pass in headers something like that:
Authorization: Basic <some token>
And then call:
Request::getParam('session_id')
Then this call will return <some token>.
There are some convenient wrappers were implemented:
// will return true if the parameter exists
// will return false otherwise
Request::wasSubmitted('param-name')
Or wrapper for check-boxes:
Request::getChecked('param-name', ['switched on', 'switched off'])
Request::getChecked('param-name', [1, 0])
Request::getChecked('param-name', [true, false])
In this call the method getChecked will return the first element of the array which is passed as the second parameter. And the second element otherwise.
|  Files (12) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  Mezon (1 directory) | ||||
|    composer.json | Data | Auxiliary data | ||
|    infection.json | Data | Auxiliary data | ||
|    phpunit.xml | Data | Auxiliary data | ||
|    psalm.xml | Data | Auxiliary data | ||
|    README.md | Doc. | Documentation | ||
|  Files (12) | / | Mezon | / | Transport | / | Tests | 
| File | Role | Description | 
|---|---|---|
|  GetCheckedUnitTest.php | Class | Class source | 
|  GetParameterAsStringUnitTest.php | Class | Class source | 
|  GetParameterUnitTest.php | Class | Class source | 
|  GetRouterUnitTest.php | Class | Class source | 
|  RequestBaseTest.php | Class | Class source | 
|  WasSubmittedUnitTest.php | Class | Class source | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
 | 
 | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.