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.
✅ 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
This package requires PHP 8.2 or higher and can be installed via Composer:
composer require fast-forward/http-message
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}
$newResponse = $response->withPayload(['success' => false]);
echo $response->getPayload()['success']; // true
echo $newResponse->getPayload()['success']; // false
This package is open-source software licensed under the MIT License.
Contributions, issues, and feature requests are welcome!
Feel free to open a GitHub Issue or submit a Pull Request.