radarphp / Radar.Adr

The Action-Domain-Responder core for Radar.
MIT License
55 stars 7 forks source link

Calling PSR-17 middleware? #39

Closed cxj closed 5 years ago

cxj commented 5 years ago

I want to use the PHP DebugBar middleware with my Radar application. In theory, it should work, since Radar is PSR-7 and PSR-15 compliant, using Relay as its dispatcher, and Zend Diactoros as its message factory.

But for the life of me, I cannot figure out what to pass to $adr->middle(...) to make it work. Can anybody offer any suggestions which might help?

harikt commented 5 years ago

To my understanding Relay is not using the PSR-15 middleware syntax : https://www.php-fig.org/psr/psr-15/#12-middleware . But it should be possible via some other alternatives zend-expressive have solved ( iirc ) . I believe this is one PR : https://github.com/zendframework/zend-expressive/pull/543 . But that also means the Relay need to modify / adjust things. Alternatively you can create another middleware which is relay compatible, then calls the DebugMiddleware from inside it.

cxj commented 5 years ago

Thanks for the suggestions.

cxj commented 5 years ago

It appears that Relay v1.x is not PSR-15 compliant, but that Relay v2.x is: https://github.com/relayphp/Relay.Relay/blob/2.x/CHANGELOG.md

I am researching how difficult it would be to upgrade Radar to use Relay v2.x.

harikt commented 5 years ago

cool. Good to know. In that case it should work without much changes.