Radar.Adr icon indicating copy to clipboard operation
Radar.Adr copied to clipboard

Convert Radar to PSR-15 compatible middleware

Open kevinsmith opened this issue 6 years ago • 2 comments

This isn't meant to be merged in. Given the magnitude of changes made here, I just wanted to get initial reactions. Is this a direction the maintainers want to take this project?

No documentation or tests yet. Just the minimum necessary for a working proof-of-concept.

This is intended to become a new repository/package called Radar.Middleware. I'm working on another fork to modify the existing Radar.Adr to become just a micro-framework that wires up Aura.Di, Aura.Router, Relay 2.x, and the new Radar.Middleware, but there's no need to do that if this proposal isn't accepted.

Radar.Middleware is a fully PSR-15 compatible middleware package, uncoupled to any particular DI, middleware dispatcher, or router. It works with any PSR-11 compatible DI and any PSR-15 compatible dispatcher. And it can be used in combination with any PSR-15 compatible router that passes the route handler to the next middleware through a request attribute (customizable but named request-handler by default) such as these. It effectively subs in as an ADR-specific alternative to middlewares/request-handler. (See how that middleware is used.)

This change does remove some features though. Since Radar.Middleware is no longer coupled to Aura.Router, it can't provide route- and responder-specific features like…

My motivation here is to give us an ADR handler that can be used in a much wider variety of projects than just greenfield projects that start with Radar.Project. I've personally got a side project where I'm using PHP-DI, FastRoute, and Relay 2.x, so the existing Radar skeleton won't work. And I can see use cases for modernizing legacy projects that eventually want to move to an ADR pattern. Interoperability FTW!

So, thoughts?

kevinsmith avatar Mar 07 '18 16:03 kevinsmith

This is a neat idea. I will review it locally instead of online.

pmjones avatar Mar 08 '18 11:03 pmjones

For what it's worth, here's my brainstorming on the direction I think the radar stuff should go in terms of https://github.com/jakejohns/radar-new

jakejohns avatar Apr 02 '18 18:04 jakejohns