amphp/hpack
Fast HPACK (HTTP/2 header compression) implementation for PHP by amphp. Provides efficient encoding/decoding of header blocks with dynamic tables, Huffman coding, and compliance-focused behavior, suitable for high-performance HTTP/2 clients and servers.
net/http, Node.js http2, or Java’s Netty) where HPack is already implemented."This package eliminates a critical bottleneck in our HTTP/2 APIs by reducing header overhead, directly cutting cloud costs by 15–20% and improving response times for high-traffic endpoints. It’s a maintenance-free, RFC-compliant solution that lets our engineering team focus on core features instead of reinventing header compression. With zero dependents and active updates, it’s a low-risk investment to future-proof our async PHP services for HTTP/2—critical for edge computing and real-time applications."
"amphp/hpack gives us a lightweight, high-performance HPack implementation that integrates seamlessly with Amp/ReactPHP. It handles edge cases like dynamic table size updates and Huffman encoding automatically, reducing bugs in our HTTP/2 framing logic. The package is PHP 8.5-compatible, well-tested, and avoids the pitfalls of custom implementations (e.g., DoS risks, RFC non-compliance). We can reuse the encoder/decoder across connections for efficiency, and the static table optimizations cut memory usage in high-throughput scenarios."
"This is a low-level but critical component for any PHP-based HTTP/2 server. It’s not a silver bullet—you’ll need to pair it with Amp’s HTTP/2 framing layer and manage dynamic table synchronization—but it saves months of dev time and ensures compliance. The tradeoff? Abandoning Laravel’s default stack if you’re building a custom server. For async PHP, it’s the only viable HPack option short of writing your own."
How can I help you explore Laravel packages today?