According to these comments there are a couple of ways to get RESTful URI parameters. The first way of doing this is referring to this comment, #15:
#In the same controller
public function jsonAction($do = null, $entity = null, $argv = null)
{
print json_encode([
"response" => "200",
"body" => "JSON API called"
]);
var_dump($do); // Output string(4) "kill"
var_dump($entity); // Output string(2) "us"
var_dump($arg[0]); // Output array(1) { [0]=> string(3) "all" }
}
The second approach is according to this comment, #18:
# When we define the route
$app->get('/api/json(/:do(/:entity(/:arg+)))',
"\Slim\Controller\API:jsonAction")->setParams(
array($do, $entity, $arg)
);
And the third way of doing things, which I think is a bit ugly.. Again to #15 comment:
$app->get('/hello(/:param)',
function ($do = NULL, $entity = NULL, $arg = NULL) use($app) {
(new \controller\sayHello($app))->index($do, $entity, $arg);
});
So basically I am going to stick to the first approach, It is more elegant and more framework oriented(it handles it behind the scenes).