Chances are your code already uses one of the HTTP PSRs in some way. In this 'no slides, just code' session we'll take a hands on look at how HTTP Messages (PSR-7) and HTTP Handlers (PSR-15) work, and how they can be properly leveraged. HTTP messages provide a considerable advantage over global variables, and their immutability actually makes it easier to confidently modify an incoming request or an outgoing response in your web application. HTTP handlers are a common concept in micro-frameworks, and PSR-15 provides a way to create reusable framework-agnostic code. But that's not all it provides. The HTTP handler interface can be used to inject the concept of middleware into an existing application without having to introduce a new framework. Or to easily build a lightweight application without any framework. Take a guided tour through both PSRs, and find out how you can used them effectively in your current codebase.
What you'll learn from this talk:
- the value in immutable HTTP Request objects
- how to evolve an HTTP Request object
- how to extend a library's HTTP Request object
- how a middleware stack works
- how easy it is to use PSR-7 & PSR-15 without any framework