HTTP Patterns: PSR 7 & 15 By Example
summary
Live coding shows PSR-7 request/response objects as immutable, how to evolve them with with methods, and how streams can be detached and transformed; PSR-15 middleware takes a ServerRequest and a handler so a simple middleware stack handler runs route, auth and logging middleware in order. The demo builds a tiny weather/traffic API, adds logging and bearer-token auth, emits responses with Laminas emitters, and uses the Tortilla/Burrito wrapper to add convenience methods — everything runs and is easy to unit test.
AI-written summary · about
chapters (11)
- 0:00Introduction and overview
- 1:20Working with PSR-7 requests
- 6:04Immutability in PHP
- 11:37Handling attributes and routes
- 13:35Response management
- 16:49PSR-15 request handlers
- 22:21Middleware patterns
- 30:21Implementing middleware
- 37:10Middleware strategy
- 43:53Convenience libraries
- 49:30Closing remarks
related talks
52mPSR 7 HTTP Messages In the Wild
45mFrom Helpers to Middleware
41mFrom Helpers to Middleware
46mPSR-18: Abstracting HTTP clients in PHP
35mSpeed up web APIs with Expressive and Swoole
46mRethinking Server-Side Rendering in Modern PHP Applications
29mLuke Downing :: Lessons from the Laravel Framework
47mA Collection of Microservice Patterns
