Guzzle is a PHP HTTP client for sending requests and integrating with web APIs. It exposes one interface for sync and async calls with PSR-7 and PSR-18 compatibility.
Overview
Guzzle focuses on making routine HTTP work in PHP straightforward: building query strings, form posts, large uploads and downloads, cookies, and JSON payloads through a single client API. The same surface supports synchronous and asynchronous requests.
Requests, responses, and streams are modeled with PSR-7 interfaces so other PSR-7 libraries can plug in. PSR-18 support lets projects swap HTTP clients while keeping shared abstractions.
The transport layer is abstracted behind handlers, so application code does not need to depend on cURL, PHP streams, sockets, or a specific event loop. A middleware stack lets you layer retries, logging, or custom behavior around the core client.
Documentation covers request options, cookie jars, exception types, handler configuration, middleware composition, and patterns for testing clients that wrap Guzzle.
Key features
- Sync and async requests on one client
- PSR-7 message and stream interfaces
- PSR-18 HTTP client interoperability
- Pluggable HTTP transport handlers
- Composable middleware pipeline
- JSON, forms, cookies, and streaming I/O
- Transport-agnostic application code
- Documented testing patterns for clients
Use cases
- Calling REST APIs from PHP applications
- Uploading or downloading large files over HTTP
- Sharing HTTP abstractions across PSR-7 libraries
- Adding retries and logging via middleware
- Integrating third-party web services in PHP