feature #804 added a way to delay the attachment of a controller to a route (fabpot)
This PR was merged into the master branch. Discussion ---------- added a way to delay the attachment of a controller to a route There are several ideas behind this PR. It's mostly about consistency by being able to decouple the setting of a controller from the match call. The old way still works of course. It is more consistent as everything can now be done via method calls and the fact that the controller is the second argument makes things uglier, especially when the code in the controller is large. As an added bonus, it helps when indenting the code (currently, I always wonder how to indent my code as it's not obvious). Last, but not the least, being able to put the code last also makes things more readable. Current: ``` $app->get('/foo', function ($id) { // ... }) ->bind('home') ->assert('id', '\d+') ; ``` Now: ``` $app ->get('/foo') ->bind('home') ->assert('id', '\d+') ->run(function ($id) { // ... }) ; ``` Commits ------- 8fbb9369 added a way to delay the attachment of a controller to a route
Showing
Please register or sign in to comment