PSR-18: Abstracting HTTP clients in PHP
summary
Defines how to send PSR-7 requests without binding code to a specific client and specifies exact behavior: one method that returns a response or throws well-defined request or network exceptions, adapters exist for Guzzle and Symfony HTTP client, and a middleware/plugin ecosystem (headers, auth, cache, routing) is already built and works. Configuration lives on the client, not per-request; optional auto-discovery finds implementations; synchronous by PSR-18 but async patterns exist via promises and emerging fiber support; there is a symfony bundle and compatibility layer from HTTP Plug.
AI-written summary · about
chapters (33)
- 0:00Introduction
- 2:04About me
- 4:02The root cause
- 4:45Davids personal situation
- 5:22HDD plug
- 5:37Adapters
- 6:26FrameworkInteroperability Group
- 8:24HTTP Requests and Responses
- 16:52HTTP Client Configuration
- 17:55Array Configuration Options
- 20:00Reusable Libraries
- 21:58AutoDiscovery
- 22:56HTTP plug interface
- 24:04Middleware
- 26:03Cache
- 26:48Constructors
- 27:21Authentication
- 28:21HTTP Client Router
- 29:25HTTP Batch Client
- 32:45Symphony Bundle
- 33:03Configuration
- 33:44Toolbar
- 33:56Information page
- 35:53asynchronous requests
- 36:53promises
- 38:02fibers
- 39:47promise
- 40:53promise loop
- 41:14promise string
- 42:41callback function
- 43:21result callback
- 43:34result array
- 43:55subclients
related talks
52mPSR 7 HTTP Messages In the Wild
38mPHP FIG: Helping communities work together
44mPSR-14: A major PHP Event
52mHTTP Patterns: PSR 7 & 15 By Example
02h 03mWriting API clients with HTTPlug
39mBuilding RESTful APIs with Symfony Components
57mBuilding first-class REST APIs with Symfony
35mSpeed up web APIs with Expressive and Swoole
