codeguy/Slim — pull request #639 by designermonkey (2013-09-22 08:49:33+00:00)
Title: Controllers

Controllers allow you to specify a controller class for routes. Based on @fortrabbit's work in SlimController, but a much simpler implementation to begin with.

Routes can be specified as

```
$app->get('/books/:id', function ($id) {
//Show book identified by $id
});
```

With Controllers, they can be specified as

```
$app->get('/books/:id', 'Books::booksList');
```

and require a class as such

```
class Books
{
public function booksList($id)
{
//Show book identified by $id
}
}
```

Controllers can have a default namespace specified in the settings with a key of `controller.namespace`, which will prepend the class specified in every controller string.