Slide 10
Slide 10 text
Slim Framework: Routes
$app->get(‘/hello/{name}’, function($request, $response, $args) {
echo ‘GET home: ’.$args[‘name’];
});
$app->get(‘/id/{id:[0-9]+}’, function($request, $response, $args) {
echo ‘GET id: ’.$args[‘id’];
});
$app->group(‘/user’, function() {
$this->>get(‘/view’, function($request, $response) {
echo ‘GET /user/view’;
});
$this->post(‘/view’, function($request, $response) {
echo ‘POST /user/view’;
});
});