Closed shadowhand closed 9 years ago
Agreed. I have worked up a rewrite of the middleware system to use chaining, a la Conduit from MWOP, rather than filters. You can see the mostly-tested but as-yet-undocumented work in the temporary "midwrap" branch. https://github.com/radarphp/Radar.Adr/tree/midwrap
Radar.Project now has a matching "midwrap" branch with documentation; the relevant major doc change is here. I like this approach a lot better than the previous one; the immutability of the request/response pair biases architectures toward this kind of implementation, I think. @shadowhand your thoughts?
@pmjones sorry I didn't get back to you sooner... I think the "midwrap" changes are great! TBH I haven't completely wrapped (heheh) my mind around how the stacking works, but I probably just need to read the tests again. Thanks!
That's good news, then. I think this ends up being easier once you "get" it but that might take a bit (like it took me).
As per this discussion, the current implementation of middleware could be improved by following this pattern (which is derived from Stack):
This preserves the immutable nature of PSR-7 interfaces without having to use pass-by-reference to "modify" the immutable objects.