guzzlehttp/psr7
Full PSR-7 message implementation with rich stream support: multiple stream types and decorators (append, buffer, caching, etc.), plus helpers like query-string parsing. Installed via Composer and maintained with v2 for PHP 7.2.5+.
Illuminate\Http\Client) and framework components (e.g., Symfony\Component\HttpFoundation) rely on PSR-7 under the hood. This package ensures consistency with Laravel’s ecosystem.CachingStream, LimitStream, InflateStream) are invaluable for:
Http facade and Guzzle integration (via guzzlehttp/guzzle) already depend on PSR-7. This package is pre-installed in most Laravel projects via symfony/http-foundation or guzzlehttp/psr7.Utils::streamFor, Query::parse) that simplify testing HTTP interactions in Laravel’s unit/feature tests.guzzlehttp/guzzle (v7+) bundles PSR-7 v2.x. Ensure no conflicts with custom guzzlehttp/psr7 installations.CachingStream may introduce memory overhead for large streams. Monitor in production.Header::normalize() is deprecated in favor of splitList(). Audit custom code using these methods.LimitStream for S3) or just PSR-7 compliance?guzzlehttp/psr7 to a specific version (e.g., ^2.6) to avoid conflicts with Laravel’s bundled Guzzle?symfony/http-foundation) that could reduce duplication?CachingStream/BufferStream impact latency/memory? Benchmark with real payloads.FnStream for runtime stream modifications? This could complicate debugging.Illuminate\Http\Client (uses PSR-7 under the hood).GuzzleHttp\Client (if using guzzlehttp/guzzle).Symfony\Component\HttpFoundation (bundled with Laravel).guzzlehttp/psr7:^2.6 (latest stable).guzzlehttp/guzzle, Laravel’s composer.json may already include PSR-7. Use composer why guzzlehttp/psr7 to check.RequestInterface, StreamInterface).LimitStream for chunking).fopen + stream_get_contents) with Utils::streamFor().CachingStream for retryable requests).composer.json:
"require": {
"guzzlehttp/psr7": "^2.6",
"php": "^8.1"
}
composer update guzzlehttp/psr7 --with-dependencies.| Component | Compatibility Notes |
|---|---|
| Laravel 9/10 | ✅ Full support (uses PSR-7 v2.x). |
| Guzzle v7.x | ✅ Bundles PSR-7 v2.x. No conflicts expected. |
| Symfony HttpFoundation | ⚠️ May bundle a different PSR-7 impl. Use composer why to resolve. |
| Custom Middleware | ✅ Replace Symfony\Component\HttpFoundation streams with guzzlehttp/psr7 decorators. |
| File Uploads | ✅ MultipartStream/LimitStream for chunked uploads to S3/Cloud Storage. |
Utils::streamFor('data')) in tests/controllers.Query::parse/Query::build for URL query handling.AppendStream for concatenating files).Request/Response objects.StreamDecoratorTrait for custom logic.Symfony streams with guzzlehttp/psr7 in legacy code.FnStream) can obscure call stack for errors.CachingStream buffers data in-memory/disk. Monitor memory_get_usage().read()/write() calls).LimitStream to cap memory usage for large payloads.MultipartStream with Laravel Filesystem").LimitStream + PumpStream enable memory-efficient processing of GB-sized files.CachingStream disk spillover.PumpStream to stream-process large files in queues (e.g., Laravel Queues).| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Stream Corruption | Partial data reads/writes. | Use hash() utility to validate stream integrity. |
How can I help you explore Laravel packages today?