A super lightweight, strict, and fast PSR-7 and PSR-17 implementation for PHP.
Nyholm/psr7 is a PHP library that provides a complete and strict implementation of the PSR-7 (HTTP message interfaces) and PSR-17 (HTTP factories) standards. It is designed to be minimal, highly compliant, and optimized for performance, offering efficient HTTP message handling without extra bloat.
PHP developers building applications or libraries that require PSR-7/PSR-17 compliant HTTP message handling, such as those working with HTTP clients, servers, or frameworks like Symfony.
Developers choose Nyholm/psr7 because it is a lightweight, fast, and strictly compliant implementation that outperforms alternatives in benchmarks, with a small codebase of around 1,000 lines and no unnecessary features.
A super lightweight PSR-7 implementation
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Achieves 100% on PSR-7 integration tests, fully adhering to specifications without extra public methods, as highlighted in the README comparison table.
Outperforms Guzzle, Laminas, and Slim in benchmarks with 17,734 runs per second, making it ideal for performance-critical applications.
Has only 1,000 lines of code, significantly less than competitors like Guzzle (3,300 lines), reducing overhead and maintenance burden.
With Symfony Flex, HTTP message factories are automatically registered as services, simplifying setup for Symfony-based projects.
Easily integrates with HTTPlug for flexible HTTP client usage, as shown in the usage examples with libraries like Buzz.
Strictly follows PSR-7, so common utilities like URL parsing or cookie management are absent, requiring manual implementation or additional packages.
For full functionality, such as server requests or response emission, you must install separate packages like nyholm/psr7-server or laminas/laminas-httphandlerrunner.
While it works with HTTPlug and Symfony, it lacks the extensive middleware or plugin ecosystem of more established libraries like Guzzle or Laminas.
The README is concise and focuses on basic usage, which may not suffice for developers new to PSR-7 or needing in-depth guidance on advanced scenarios.