Controllers

Instead of defining all of your route-level logic in a single app/routes.php file, you may wish to organize this behavior using Controller classes. Controllers can group related route logic into a class and are typically stored in the app/Controllers directory.

Don't forgot to namespace your controllers. Here is an example of a basic controller class:

Below is a more advanced example demonstrating how you could include the Http component of the framework. On top of that we show you how to return different http statuses (in this case 404) as well as a json response.