ralouphie/getallheaders
Polyfill for PHP’s getallheaders() providing a consistent way to retrieve HTTP request headers across SAPI environments (CLI, built-in server, FPM, etc.). Lightweight, framework-agnostic, commonly used in PSR-7/HTTP tooling.
Architecture fit: This polyfill provides a drop-in replacement for PHP's missing getallheaders() function in environments where it's unavailable (e.g., CLI, certain SAPIs like Nginx/FastCGI). Ideal for projects requiring consistent header handling across diverse server configurations without conditional code checks.
Integration feasibility: High. Composer-based installation requires minimal code changes—only dependency addition. The polyfill automatically registers itself via autoloading, making it transparent to application code.
Technical risk: Low-moderate. Widely adopted (3.8k stars) but potential edge cases in header parsing (e.g., duplicate headers, special characters, HTTP/2). No official support for version-specific quirks.
Key questions: What specific PHP versions/SAPIs does it fully support? How does it handle multi-value headers (e.g., Set-Cookie)? Are there known issues with non-ASCII characters or custom header formats?
Stack fit: Best suited for PHP applications targeting environments where getallheaders() is absent (e.g., legacy PHP <5.4, custom server setups). Works seamlessly with modern frameworks (Laravel, Symfony) and standard web stacks (Apache/Nginx).
Migration path: Add to composer.json, run composer update, and replace existing manual header-fetching logic with direct getallheaders() calls. No code restructuring needed—polyfill overrides the native function if missing.
Compatibility: Supports PHP 5.2+ (per package docs). Verify compatibility with target PHP versions and server modules (e.g., mod_php
How can I help you explore Laravel packages today?