http-interop / http-middleware

PSR-15 interfaces for HTTP Middleware
MIT License
73 stars 7 forks source link

PSR-17 dependency #42

Closed atanvarno69 closed 7 years ago

atanvarno69 commented 7 years ago

In #41 @DaGhostman posted:

Has something like All about middleware been discuessed, more specifically the 3rd approach in section But What About Dependency Inversion???, which will obviously make this interface dependant on PSR-17?

Rather than clog up #41, it seems sensible to discuss the issue here.

To my mind there are a few approaches that work:

schnittstabil commented 7 years ago

Related: https://github.com/http-interop/http-middleware/pull/41#issuecomment-263984461

shadowhand commented 7 years ago

The expectation is that any middleware that needs to create HTTP messages will depend on PSR-17.

mindplay-dk commented 7 years ago

The expectation is that any middleware that needs to create HTTP messages will depend on PSR-17

That's definitely my expectation, down the line.

For the time being, simply depending on Diactoros has been working fine for me. Of course, you wouldn't like to end up with an application depending on two different implementations of PSR-7, hence PSR-17, but there is likely no harm in doing so right now, since, for any given request, ultimately one response is generated, so only one implementation of the response interface will be loaded per request anyway.

Definitely looking forward to PSR-17, but we're okay for the time being, since there's only really one or two implementations of PSR-7 to choose from, and not that many middleware components actually generate a response in the first place.