Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

php-fast-forward/http-message

Repository files navigation

Fast Forward HTTP Message

License Tests

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.

AltStyle によって変換されたページ (->オリジナル) /