borsch / http-message-factories
PSR-7 HTTP Message 和 PSR-17 HTTP Factories 的实现。
1.0.6
2019-08-23 06:38 UTC
Requires
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
- ralouphie/getallheaders: 3.0.3
README
这是一个简单轻量且高效的 PSR-7 HTTP Message 和 PSR-17 HTTP Factories 实现。
安装
通过 Composer
$ composer require borsch/http-message
用法
PSR-7 类除了规范中列出的方法外,没有其他方法。
例如,没有 Response::withJson()
方法,如 Slim 框架 中的那样。
但是有一个 Helper
类,您可以在创建 ServerRequest 实例时使用它来解析 $_FILES。
实例化
此包使用 PSR-17 构造函数签名作为 PSR-7 类的构造函数,从而在两个包之间保持连续性和自然逻辑。
require_once __DIR__.'/vendor/autoload.php'; use Borsch\Http\Request; use Borsch\Http\Factory $request = new Request( 'GET', 'https://github.com/debuss/borch-http-message' ); // OR $request = Factory::getInstance()->createRequest( 'GET', 'https://github.com/debuss/borch-http-message' );
玩一玩 PSR-7 类和 PSR-17 Factory,看看如何使用它们 ;)
许可协议
MIT License
Copyright (c) 2018 Alexandre DEBUSSCHERE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.