But first - More History • 2014 - everyone* has gone out and built and object model of HTTP • Hello World for writing a framework • None of them are compatible • Symfony\HttpFoundation widely used 10
Components of a PHP Middleware App • PSR-7 implementation • Collection of middleware • Middleware dispatcher • Any other libraries that will actually do business logic for you 17
What does a middleware look like? 20 $middleware = function( \Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, callable $next) { // do the actual stuff };
PSR-15 • There is still some debate as to which is better • It’s likely the standard will not pass along the response • Lots of existing middleware out there that would not meet this spec 22