Routes

Once you have a project and a controller, you need to create routes to map requests to your actions. A route file will be included in your project folder (called routes.php) that you can use for all of your routes.

Here is an example:

1
2
3
4
5
<?php
$app->get('/action', function ($request, $response) {
    $controller = new \MyProject\Controllers\Index($this, $request, $response);
    return $controller->index();
});

More information about routing is available on Slim's website.