ezimuel/guzzlestreams
A lightweight library that adds stream and iterator utilities on top of Guzzle, making it easier to work with PHP streams, filters, and resource handling. Useful for piping, buffering, and composing stream operations in HTTP-related code.
ezimuel/guzzlestreams) remains a critical fork of guzzle/streams, now explicitly supporting PHP 8.4 (via PR #3). This aligns with modern Laravel/PHP stacks and reinforces its role as a streaming solution for Elasticsearch-PHP, particularly for bulk operations or large payloads.
GuzzleStreamWrapper, utilities).phpunit --testdox).| Risk Area | Severity | Mitigation |
|---|---|---|
| PHP 8.4 Compatibility | Low | Validate with your CI/CD (e.g., php -v, composer validate). |
| Elasticsearch-PHP Drift | Medium | Monitor Elasticsearch-PHP’s roadmap for Guzzle stream deprecations. |
| Stream Injection | Medium | Sanitize all file:// or php:// streams (e.g., filter_var($url, FILTER_VALIDATE_URL)). |
| Performance Regression | Low | Benchmark against Guzzle v7.4+ (e.g., phpbench for bulk operations). |
| Fork Maintenance | Medium | Subscribe to the repo’s issue tracker; contribute fixes upstream if possible. |
symfony/stream-wrapper)?Client::bulk(), Snapshot API).symfony/stream-wrapper).Client::bulk() calls).guzzle/streams with ezimuel/guzzlestreams:^4.1 in a non-prod environment.composer.json and dependencies.guzzle/streams in Elasticsearch-PHP config.GuzzleStreamWrapper.| Component | Compatibility |
|---|---|
| Guzzle HTTP Client | v7+ (required). Use guzzlehttp/guzzle:^7.4 in composer.json. |
| Elasticsearch-PHP | v8+ (tested with fork). Avoid v7.x. |
| PHP 8.4 | ✅ Supported (verified in release notes). |
| PHP Extensions | fileinfo, curl (for HTTP transport). |
| Frameworks | Framework-agnostic; works with Laravel, Symfony, or standalone PHP. |
| Cloud Providers | Test with AWS/GCP proxies (some may block non-standard streams). |
composer require ezimuel/guzzlestreams:^4.1
composer remove guzzle/streams # If present
$client = Elastic\Elasticsearch\ClientBuilder::create()
->setHosts(['http://elasticsearch:9200'])
->setStreamWrapper(new \Ezimuel\GuzzleStreams\GuzzleStreamWrapper())
->build();
StreamWrapper for chunked payloads:
$stream = new \Ezimuel\GuzzleStreams\GuzzleStreamWrapper('php://temp', 'w+');
$stream->write(json_encode($bulkPayload));
$stream->seek(0);
$response = $client->getBulkResponse($stream);
$client->setHandlerStack(
\GuzzleHttp\HandlerStack::create([
new \GuzzleHttp\Middleware::debug()
])
);
stream_get_meta_data()) for failures.timeout in Guzzle config (e.g., connect_timeout → 30s).php://temp instead of php://memory for large streams.memory_limit (e.g., 2GB for large streams).opcache to reduce stream initialization overhead.// k6 example for PHP 8.4
import http from 'k6/http';
export default function () {
const payload = new Array(1000).fill('{"index": {"_index": "test"}}' + JSON.stringify({ foo: 'bar' }));
http.post('http://elasticsearch:9200/_bulk', payload.join('\n'), { tags: { stream: true } });
}
How can I help you explore Laravel packages today?