Search code examples
codeigniter

Is there a concept of a middleware in CodeIgniter?


I want to do some pre and post processing of requests like handling authentication, loading contextual data, performance timings and things like that. Coming from Django there's a concept of MIDDLEWARE_CLASSES that lets me handle the request in various stages: https://docs.djangoproject.com/en/dev/topics/http/middleware/

Currently it seems like each Controller has to do the same setup and load, in the constructor which isn't ideal because if the constructor fails, the class doesn't get initialized which has subtle but important consequences. I want to move this global handling to a global place.

Any suggestions?


Solution

  • There is not. This might be helpful. Codeigniter forum