We should Implement PSR-7 which is a requirement for T194393: Implement standard middleware interface in MediaWiki (PSR-15)
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T194393 Implement standard middleware interface in MediaWiki (PSR-15) | |||
Open | None | T194397 Implement standard HTTP message interface in MediaWiki (PSR-7) |
Event Timeline
Task description needs fleshing out. What is PSR-7 (a TLDR version at least, rather than just a link elsewhere)? Why? What does this do for us? Just allowing us to implement PSR-15? Or do we get other benefits too?
I mean I think there's value in having a "standard" request/response pipeline using industry-standard request and response interfaces, however, there's not really a huge advantage in that if we can't plugin middlewars (or abstract some of our code as middlewares).
In practice I suppose this would mean:
- WebRequest should implement ServerRequestInterface
- WebRequestUpload should probably implement UploadedFileInterface
- WebResponse should implement ResponseInterface
- MWHttpRequest should implement RequestInterface (which is fairly useless for interoperability; software that aims for that should probably implement PHP-HTTP as well)
Implementing PSR-7 + PHP-HTTP for MWHTTPRequest would mean that it could be easily used outside of MediaWiki (I doubt there is much use case for that; maybe if we had PHP-based microservices and wanted them to have all the query-parameter-wrangling behavior of MediaWiki?) and it could be easily replaced via the service container with another library (that seems useful; MWHttpRequest does not offer much in terms of features). Implementing PSR-7 in WebRequest / WebResponse does not seem directly useful (it would be a requirement for PSR-15 compliance though).
MediaWiki-REST-API did implement PSR-7. Not sure there is much value in doing it also for MwHttpRequest, or the action API, or WebRequest/WebResponse.