|Open||None||T194393 Implement standard middleware interface in MediaWiki (PSR-15)|
|Open||None||T194397 Implement standard HTTP message interface in MediaWiki (PSR-7)|
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 [[https://github.com/php-fig/http-message/blob/master/src/ServerRequestInterface.php|ServerRequestInterface]]
- WebRequestUpload should probably implement [[https://github.com/php-fig/http-message/blob/master/src/UploadedFileInterface.php|UploadedFileInterface]]
- WebResponse should implement [[https://github.com/php-fig/http-message/blob/master/src/ResponseInterface.php|ResponseInterface]]
- MWHttpRequest should implement [[https://github.com/php-fig/http-message/blob/master/src/RequestInterface.php|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).