URI - Historically
• parse_url()
• parse_str()
• http_build_query()
7
Slide 8
Slide 8 text
DID WE END UP HERE?
How in the hell
8
Slide 9
Slide 9 text
PSR-7
Enter
9
Slide 10
Slide 10 text
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
What is middleware?
• Turns a Request into a Response
• Stackable
• Reusable
• Dispatachable
14
Slide 15
Slide 15 text
PHP Copied This Trend
• Node.js Connect
• Ruby Rack
• Python WSGI
• Even StackPHP
15
Slide 16
Slide 16 text
Express.js is getting it right
• All middleware all the way down
• Even error handlers are middleware
• Even the app instance itself is middleware
16
Slide 17
Slide 17 text
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
Pick a PSR-7 Implementation
• Do not write one
• Unless you’re using Slim already just use
Zend/Diactoros
19
Slide 20
Slide 20 text
What does a middleware look like?
20
Slide 21
Slide 21 text
It might also look like this
21
Slide 22
Slide 22 text
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