Routing is used to map url request to action handler, the simplest one is using route callback, routing configuration is located in app/routes.php

Route::get('/', function(){
    Response::setBody('Hello world');

Route::post('/', function(){
    Response::setBody('Some data posted');

Route Parameter

Route parameter is part of the URL that will be passed to the callback as function argument

Route::get('book/:id', function($id){
    Response::setBody('Showing book with id '.$id);

Optional route parameter

Route::get('/hello(/:name)', function ($name) {
         Response::setBody('Hello '.$name);
         Response::setBody('Hi Anonymous!');

Route Group

Since SlimStarter is based on Slim, it lets you group related routes. This is helpful when you find yourself repeating the same URL segments for multiple routes.

/** Route group to book resource */
Route::group('/book', function(){
    Route::get('/', 'BookController:index'); // GET /book
    Route::post('/', 'BookController:store'); // POST /book
    Route::get('/create', 'BookController:create'); // Create form of /book
    Route::get('/:id', 'BookController:show'); // GET /book/:id
    Route::get('/:id/edit', 'BookController:edit'); // GET /book/:id/edit
    Route::put('/:id', 'BookController:update'); // PUT /book/:id
    Route::delete('/:id', 'BookController:destroy'); // DELETE /book/:id