fast-forward/http-message
最新稳定版本:v1.3.0
Composer 安装命令:
composer require fast-forward/http-message
包简介
Fast Forward PSR-7 HTTP Message utility classes
README 文档
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.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-30