IF YOU WANT TO GET PARAMS WITH THE NAME PARAM
$value = $app->request->params('key');
The params () method will first look for PUT variables, then POST variables, and then GET variables. If no variables are found, null is returned. If you only want to search for a specific type of variable, you can use these methods instead:
// --- GET variable
$paramValue = $app->request->get('paramName');
// --- POST variable
$paramValue = $app->request->post('paramName');
// --- PUT variable
$paramValue = $app->request->put('paramName');
IF YOU WANT TO GET ALL THE PARAMETERS FROM THE REQUEST, NOT SPECIFYING THE PARAMETER NAME, YOU CAN GET ALL OF THEM IN ARRAY IN THE FORMAT KEY => PRICE
$data = json_decode( $app->request->getBody() ) ?: $app->request->params();
$ data will be an array that contains all the fields from the request, as shown below
$data = array( 'key' => 'value', 'key' => 'value',
Hope this helps you!
KlevisGjN Jan 26 '16 at 18:52 2016-01-26 18:52
source share