PHP, while built for the web, provides little in the way of HTTP message abstraction; in fact, it often gets in the way of accessing even trivial aspects of requests such as headers! For this reason, many developers turn to frameworks, as a primary facility of most is to provide HTTP message abstractions. Doing so introduces a problem: most frameworks impose non-trivial performance overhead.
PSR-7 is an initiative of the Framework Interop Group, and provides interface abstractions for HTTP messages. The goal is to allow better re-use of web-facing code — but one expected outcome is that Middleware solutions will naturally evolve.
What is middleware? Code that sits between a request and a response.
In this talk, we’ll look at PSR-7, some common middleware patterns, and how middleware may allow you to create application architectures that can reduce bootstrapping overhead in order to deliver more performant websites.