DI Factories for Slim controllers
When using classes for route actions in Slim 3, I recommend using a single class for each route. However you can use a single class for multiple routes. To register a class method to a route you pass a string as the route callable where the class name is separate from method by a colon like this: $app->get('/list', 'MyController:listAction'); Slim will retrieve MyController from the DI container and then call the listAction method using the… continue reading.