symfony/http-foundation doesn't implement psr/http-message

654 views Asked by At

why symfony http-foundation doesn't implement psr http-message ?? I want to use php frameworks interoperability.

in my opinion router , dispatcher , ioc container, http message and ... should have a psr interfaces and all frameworks should obey the interfaces.

so I want to simply implement my project not to use a specific php framework just use php packages which I need.

should I implement all that stuff myself ?? isn't it obvious that all frameworks should implement psr interfaces??

and after all why other psr standards (router, dispatcher, container)are taking too much time??

1

There are 1 answers

1
Wouter J On BEST ANSWER

HttpFoundation and PSR-7 have a very very different basis (the biggest difference is the fact that PSR-7 objects are immutable, while HttpFoundation's objects are mutable). This makes it hard (if not impossible) for Symfony to update HttpFoundation to the PSR-7 interface without introducing a complete rewrite (and thus lots of backwards compatibility breaks for all current Symfony applications).

In order to still provide a way of supporting PSR-7, you can use the symfony/psr-http-message-bridge (docs), which provides factories to transform the HttpFoundation Request and Response into PSR-7 request and responses messages (and the other way around).

This is done automatically for you when you typehint against the PSR-7 interfaces in your controller instead of the HttpFoundation request.