Open leroy0211 opened 9 years ago
This would be awesome : )
@leroy0211 Just ran across this article, they're making it sound this is normal bake-in functionality in Clim Framework 3 http://juliangut.com/blog/slim-controller
@ctsstc it is kinda the same. There is something like a Controller way right inside SF3, but it's all "static", just like calling call_user_func('Class::method')
. The constructor of that Class
will never be called, therefor something like dependency injection with Pimple or my own Symfony DI Bridge is never possible.
What really would be interesting is that routes can be configured, but on a dynamic level. And all object oriented instead of calling methods statically.
EG:
the route /hello
can be attached to a controller called: "HelloController". Every method suffixed with Action
is a subroute on the /hello
route. For example a public function worldAction()
can be called as /hello/world
.
Or if you would like to specifically assign routes to methods this would be configurable too. Like the /
route must be attached to the HomeController::indexAction()
method.
Or by taking it to the next level, that a route can be attached to another route configuration.
For example /bye
route will be configured to watch to another config section where /cruel
route is being attached to a controller called JustAnotherController
. In that controller is a method public function worldAction()
so the route /bye/cruel/world
is being created to match the right controller-action (but this might be too many steps forward).
This would be a great https://hacktoberfest.digitalocean.com/ project 😉
I am wondering if you would update to be compatible with Slim Framework 3 when it will be in stable release.