Look at the following approaches:
$app->get('/', function () use ($app) {
// ... code here!...
echo $app->view->render('index', $params);
})->setName('home');
or
$app->get('/', 'indexAction')->setName('home');
function indexAction(){
global $app;
// ...code here!!!..
echo $app->view->render('index', $params);
}
Which is the best option? , Okay use 'global' ?, please I need some advice.