I have read PSR-15 from PHP-FIG (HTTP Server Request Handler) and wondering when an action is called (Controller action or Closure).
When processing through all middlewares the action should be called after passing all middlewares. After the action all middlewares are passed again from the inside to the outside (as described in the User Guide from Slim Framework).
I browsed the Code from Laravel on GitHub, but can't figure out how they call the action and then traverse all of the middlewares again.
This answer tells me that Slim adds itself to the middleware stack. I guess it then executes the action somehow. However, Slim is using double pass.
How does a middleware stack and execution look with single pass (as described in PSR-15) and call an action between all of the middlewares?
I started actually adding the controllers as middlewares. For that to work the RequestHandler has to be able to accept new middlewares to be added. And my router does the job of assigning the appropriate middleware. That way I may also assign more than one action per route.