fast-forward / http-message
Fast Forward PSR-7 HTTP Message utility classes
Requires
- php: ^8.2
- nyholm/psr7: ^1.8
- psr/http-message: ^2.0
Requires (Dev)
- coisa/php-cs-fixer: ^2.1
- phpspec/prophecy-phpunit: ^2.3
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.5
This package is auto-updated.
Last update: 2025-06-30 23:15:57 UTC
README
Overview
The Fast Forward HTTP Message library provides utility classes and implementations for working with PSR-7 HTTP Messages in PHP, with a strong focus on immutability, strict typing, and developer ergonomics.
This library is designed to extend and complement nyholm/psr7
, providing additional structures for managing payloads, including convenient support for JSON and other payload-centric responses.
Features
✅ Fully PSR-7 compliant
✅ Strictly typed for PHP 8.2+
✅ Immutable by design (PSR-7 standard)
✅ Convenient JSON response with automatic headers
✅ Payload-aware interfaces for reusable patterns
✅ No external dependencies beyond PSR-7
Installation
This package requires PHP 8.2 or higher and can be installed via Composer:
composer require fast-forward/http-message
Usage
Json Response Example
use FastForward\Http\Message\JsonResponse; $response = new JsonResponse(['success' => true]); echo $response->getStatusCode(); // 200 echo $response->getHeaderLine('Content-Type'); // application/json; charset=utf-8 echo (string) $response->getBody(); // {"success":true}
Payload Access and Immutability
$newResponse = $response->withPayload(['success' => false]); echo $response->getPayload()['success']; // true echo $newResponse->getPayload()['success']; // false
🛡 License
This package is open-source software licensed under the MIT License.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
Feel free to open a GitHub Issue or submit a Pull Request.