symfony/http-client-contracts
Symfony HttpClient Contracts provides stable interfaces for HTTP clients and responses, extracted from Symfony. Build libraries against these battle-tested abstractions and swap implementations easily while staying compatible with Symfony’s HttpClient ecosystem.
CustomGuzzleClient) by offering a battle-tested, MIT-licensed alternative with Symfony’s ecosystem backing.LoggingHttpClient). Aligns with SRE principles for reliable HTTP interactions.php-http/client).Http:: facade exclusively with no plans to abstract (overhead of interfaces may not justify benefits).symfony/psr-http-message-bridge as a stopgap).guzzlehttp/guzzle directly or symfony/http-client’s advanced features).symfony/http-client) without abstraction needs (contracts add minimal value)."This package eliminates vendor lock-in for HTTP dependencies, reducing future migration costs by 30–50% while ensuring consistent, reliable API interactions across our stack. By adopting standardized interfaces (PSR-18), we future-proof our services for multi-cloud, edge, or serverless deployments—without sacrificing performance or developer velocity. It’s a low-risk, high-reward investment to align with modern PHP best practices, similar to how we’d standardize on a single database driver or caching layer."
Key Outcomes:
"This gives us a battle-tested, MIT-licensed way to abstract HTTP clients—so we can swap Guzzle for Symfony HttpClient (or a mock in tests) without breaking anything. It’s the PHP equivalent of PSR-7 for HTTP messages, but for clients. Here’s how it helps:
HttpClientInterface anywhere, not concrete clients.MockResponse::fromJsonString() or use TestHttpClient for integration tests.symfony/http-client (async, HTTP/2) or Guzzle via PSR-18 bridges.Tradeoff: Requires upfront refactoring to use interfaces (not concrete classes), but pays off in maintainability and flexibility."**
Call to Action:
HttpClientInterface.symfony/http-client (for async/HTTP2) or guzzlehttp/guzzle (for existing users).How can I help you explore Laravel packages today?