Welcome Guest, Not a member yet? Register   Sign In
Route Middleware
#1

I feel like this has been discussed somewhere else but I couldn't find it via the search.

Are there any plans to feature middleware in CI 4?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#2

(This post was last modified: 06-25-2016, 09:19 PM by ciadmin.)

Hmm - loaded question. By any conventional or enterprise definition, CodeIgniter *is* middleware.

There is, however, PSR-7 (HTTP message interfaces) and/or PSR-15 (HTTP middleware) from PHP-FIG.

These are not the same thing!

We have discussed this in the council, and do not feel that PSR-7 is consistent with CodeIgniter's goals of being lightweight. CodeIgniter is intended to be extensible, however, and there is nothing to stop a developer from adding a PSR-7 implementation or bridge to their application.

Bottom line: there are no plans to implement PSR-7 in CodeIgniter 4.
Reply
#3

(06-25-2016, 09:19 PM)ciadmin Wrote: Hmm - loaded question. By any conventional or enterprise definition, CodeIgniter *is* middleware.

There is, however, PSR-7 (HTTP message interfaces) and/or PSR-15 (HTTP middleware) from PHP-FIG.

These are not the same thing!

We have discussed this in the council, and do not feel that PSR-7 is consistent with CodeIgniter's goals of being lightweight. CodeIgniter is intended to be extensible, however, and there is nothing to stop a developer from adding a PSR-7 implementation or bridge to their application.

Bottom line: there are no plans to implement PSR-7 in CodeIgniter 4.

Sorry, I could have been much more clear. I was referring to http middleware as seen in Silex, Laravel, and Slim. The routing middleware can be very convenient.

I completely understand trying to keep it lightweight. Thank you for the response.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#4

I remember thinking about Middleware when I was working on Sprint's custom routing system a couple of years ago and came to one conclusion. In order for route middleware to really work effectively, you have to force the user to register all of their routes. Otherwise it works on some routes, but the more "traditional" method where the controller is discovered through URI segment matching, doesn't work with the middleware. So then you need a second solution for the controllers. At that point, it made more sense, in my mind, to just craft the solution for the controller.

I never did, though, for Sprint, but that's the only way I could really see it be effectively done for this framework. And that's not a bad thing, as it keeps it a little more explicit, though barely.
Reply
#5

Makes sense. I'll be honest, I forget that CI has the auto-routing feature sometimes since I register all my routes. Route middleware would seem like the natural progression for my applications but not others.

Thank you for the insight
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB