Symfony HttpClient

A low-overhead, high-performance PHP HTTP client with sync, async, and streaming support

Library
Composer
vv8.1.4
2,029stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity96
Maintenance100
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture88
Code Quality90
Innovation85
Learning Curve78

Symfony HttpClient is the HTTP client component from the Symfony framework, providing a unified API for making synchronous and asynchronous HTTP requests from PHP. It wraps native cURL bindings (via CurlHttpClient) with a pure-PHP stream fallback (NativeHttpClient), giving it near-zero overhead while still supporting HTTP/2 multiplexing, concurrent requests, and streaming responses without blocking.

Beyond the base transport, the component ships decorators for retries, caching, throttling, mocking in tests, and PSR-18/HTTPlug interoperability, making it usable both as a standalone client and as a drop-in replacement for Guzzle in libraries that expect a PSR-compliant HTTP client.

What You Get

  • A unified HttpClientInterface with both synchronous and asynchronous request semantics
  • Native cURL transport (CurlHttpClient) supporting HTTP/2 push and multiplexed concurrent requests
  • A pure-PHP fallback (NativeHttpClient) for environments without the cURL extension
  • Built-in decorators for retry logic, response caching, throttling, and request/response tracing
  • PSR-18 and HTTPlug adapters (Psr18Client, HttplugClient) for drop-in compatibility with libraries expecting those interfaces
  • A MockHttpClient for deterministic HTTP testing without network calls

Common Use Cases

  • Calling third-party REST APIs from a Symfony (or any PHP) application with automatic retries and timeouts
  • Streaming large HTTP responses (downloads, server-sent events) without loading the full body into memory
  • Firing off many concurrent outbound requests (e.g. webhook fan-out or multi-source aggregation) using async/multiplexed I/O
  • Swapping in as a PSR-18 client for libraries (like league/oauth2-client or API SDKs) that only depend on the PSR interface

Under The Hood

Architecture: The component centers on a single HttpClientInterface with two production backends selected at runtime — CurlHttpClient (preferred, using native cURL multi-handles for HTTP/2 multiplexing and concurrency) and NativeHttpClient (a pure-PHP stream-based fallback). Responses are lazy: ResponseInterface implementations only block on getContent()/getStatusCode(), letting many requests run concurrently and be awaited individually. A decorator chain (RetryableHttpClient, CachingHttpClient, ThrottlingHttpClient, TraceableHttpClient, ScopingHttpClient) wraps the base client to compose cross-cutting behavior without touching core transport code.

Tech Stack: Pure PHP 8.4+, zero mandatory runtime dependencies beyond psr/log and Symfony’s own contracts packages; optional integrations include amphp/http-client, Guzzle, and PSR-7 implementations (nyholm/psr7) for interoperability testing. Build/test tooling uses PHPUnit via phpunit.xml.dist.

Code Quality: The Tests/ directory contains 22+ test files covering the curl, native, mock, retry, caching, and PSR-18 decorators individually, with a shared HttpClientTestCase base exercising common contract behavior across backends. Naming is consistent (*HttpClient, *Trait for shared decorator logic), and exceptions are modeled as a dedicated Exception namespace rather than generic \Exception throws.

API Design: The public surface is intentionally small — request(), stream(), and a handful of options arrays — which keeps the learning curve low despite the component’s internal complexity. PSR-18 and HTTPlug adapter classes mean existing PSR-consuming code needs no changes to swap in this client, a strong developer-experience win for library authors.

Used by 10 apps in this directory

Other

Akaunting

Invoicing Finance

10,070

Open-source online accounting for small businesses and freelancers — invoices, expenses, and reporting without monthly fees or vendor lock-in.

View details
98
Repo Health
73
Technical
63
Dependency
Updated yesterday
PHP
79%
Apache 2.0

Coolify

Devops · Hosting Control Panel

60,738

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
72
Dependency
Built with
PHP79%
Blade18%
Updated yesterday
PHP
78%
Other

Craft CMS

CMS

3,601

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
63
Dependency
Built with
PHP78%
JavaScript14%
Updated today
PHP
57%
Other

Hi.Events

Ecommerce · Scheduling

3,985

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
88
Repo Health
84
Technical
67
Dependency
Built with
PHP57%
TypeScript37%
Updated 6 days ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP85%
XSLT10%
Updated 2 days ago
PHP
86%
AGPL 3.0

Kimai

Invoicing Finance · Project Management

4,918

Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.

View details
94
Repo Health
78
Technical
63
Dependency
Built with
PHP86%
Updated today
PHP
82%
Other

Mautic

Automation · Marketing · Ecommerce

10,366

The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.

View details
98
Repo Health
76
Technical
64
Dependency
Built with
PHP82%
Updated yesterday
PHP
55%
AGPL 3.0

Pixelfed

Social Media

7,069

A decentralized, self-hosted photo sharing platform built on ActivityPub for the open Fediverse.

View details
86
Repo Health
68
Technical
69
Dependency
Built with
PHP55%
Vue32%
Blade13%
Updated yesterday
PHP
84%
MIT

wallabag

Bookmarks Archiving

12,917

Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.

View details
92
Repo Health
81
Technical
59
Dependency
Built with
PHP84%
Twig13%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search