guzzle/http
Legacy Guzzle HTTP component providing request/response objects, message abstractions, and client utilities for making HTTP calls in PHP. Useful for older Guzzle integrations and compatibility layers; for new projects, prefer modern guzzlehttp/guzzle versions.
HttpClient facade, introduced in Laravel 8+) but offers deeper control for low-level HTTP operations (e.g., custom middleware, request/response manipulation, or legacy integrations).HttpClient).MockHandler or StreamHandler can simulate responses.HttpClient (built on Guzzle 6/7) suffices, as it’s more maintainable and aligned with Laravel’s ecosystem.reactphp or guzzlehttp/guzzle v7+ instead).HttpClient facade uses Guzzle 6/7, while this package is Guzzle 3 (released in 2014). Direct integration is not recommended due to:
Guzzle\Http\Client → GuzzleHttp\Client).replace or conflict constraints to prevent version collisions.guzzlehttp/guzzle v7+ (Laravel’s default) or symfony/http-client (alternative).illuminate/http relies on Guzzle 6/7).stream-context or event systems may clash with Laravel’s event dispatchers.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Version Incompatibility | Critical | Isolate Guzzle 3 in a separate service or use a monorepo with strict Composer constraints. |
| Security Vulnerabilities | High | Guzzle 3 lacks security updates (last release: 2016). Use only for non-critical paths or replace ASAP. |
| Maintenance Overhead | Medium | Document Guzzle 3’s usage as a "legacy bridge" and plan for deprecation. |
| Performance | Low | Guzzle 3 is stable but lacks modern optimizations (e.g., HTTP/2, connection reuse). |
Why Guzzle 3?
Migration Path
HttpClient?Security
Team Skills
MessageFactory, TransferStats)?symfony/http-client, buzz/buzz) that could reduce risk?HttpClient facade (e.g., no withOptions(), throw() methods).HttpClient (Guzzle 7 under the hood) or symfony/http-client.Assessment Phase:
Guzzle\Http\Message\EntityEnclosingRequest) and map them to Guzzle 7 equivalents.Isolation Strategy:
Option A: Use Composer’s replace to force Guzzle 3 in a subdirectory:
{
"require": {
"guzzlehttp/guzzle": "^7.0",
"vendor/package-with-guzzle3": "*"
},
"replace": {
"guzzlehttp/guzzle": "3.9.*"
},
"config": {
"preferred-install": "dist"
}
}
Option B: Create a wrapper facade to abstract Guzzle 3 behind a PSR-18 interface:
// app/Providers/AppServiceProvider.php
$this->app->bind(\Psr\Http\Client\ClientInterface::class, function ($app) {
return new Guzzle3ClientWrapper(new \Guzzle\Http\Client());
});
Gradual Replacement:
Illuminate\Queue\RedisQueue uses Guzzle 6/7).HttpClient.composer why guzzlehttp/guzzle to identify.Phase 1 (0–2 weeks):
Phase 2 (2–4 weeks):
Phase 3 (4–6 weeks):
HttpClient.composer.json.3.9.5) and monitor for critical vulnerabilities.Guzzle\Http\Exception\ClientErrorResponseException).Guzzle\Http\Message\RequestInterface vs. PSR-7).Guzzle\Http\Message\MessageFactory) may not port cleanlyHow can I help you explore Laravel packages today?