guzzle/plugin-log
Adds logging to Guzzle HTTP requests and responses via a plugin/listener. Capture and format request/response headers, bodies, and timing to help debug API calls, trace issues, and record activity to PSR-3 logs or custom handlers.
guzzle/plugin-log package is a read-only subtree split of Guzzle’s logging plugin for Guzzle 3 (deprecated since 2015). It provides HTTP request/response logging via PSR-3 loggers (e.g., Monolog).GuzzleHttp\Middleware). This package offers no unique value for modern Laravel apps.Log::channel()).LogMiddleware?HttpClient facade with logging middleware?GuzzleHttp\Middleware::tap() or LogMiddleware with Monolog.Log::channel().| Scenario | Approach | Tools/Steps |
|---|---|---|
| Legacy Guzzle 3 App | Direct integration (high risk). | 1. Install via Composer (guzzle/plugin-log). |
| 2. Configure PSR-3 logger (Monolog). | ||
| 3. Apply plugin to Guzzle client. | ||
| Modern Laravel App | Avoid this package. Use Guzzle 7’s LogMiddleware instead. |
1. Add guzzlehttp/guzzle:^7.0. |
| 2. Configure Monolog for structured logs. | ||
3. Use middleware: $client->getEmitter()->attach(new LogMiddleware(...)). |
GuzzleHttp\Middleware).LogMiddleware to format data for Monolog.LogMiddleware is actively maintained with community support.HttpClient integrates seamlessly with Log::channel().| Risk | Impact | Mitigation |
|---|---|---|
| Security Vulnerabilities | Guzzle 3 has unpatched CVEs. | Avoid; upgrade to Guzzle 7. |
| Logging Failures | Package may crash with Guzzle 7 or modern PHP. | Test in staging; use custom middleware. |
| Maintenance Abandonment | No updates → broken in future Laravel/PHP versions. | Fork and maintain, or migrate to Guzzle 7. |
| Integration Issues | Conflicts with Laravel’s service container or logging channels. | Isolate in a service or use Facade wrappers. |
How can I help you explore Laravel packages today?