borschphp/headers
最新稳定版本:1.0.1
Composer 安装命令:
composer require borschphp/headers
包简介
A library to help deal with headers.
README 文档
README
A library to help deal with headers.
Convenient to deal with headers in your PSR-7 implementations.
Installation
The package can be installed via composer. Simply run the following command:
composer require borschphp/headers
Usage
use Borsch\Http\Header; use Borsch\Http\HeadersMap; $content_type = new Header('Content-Type', 'application/json'); $content_disposition = new Header('Content-Disposition', 'attachment', 'filename="test.pdf"'); $accept_encoding = new Header('Accept-Encoding', 'gzip', 'deflate'); $cache_control = new Header('Cache-Control', 'no-cache'); $headers = new HeadersMap($content_type, $content_disposition, $accept_encoding); $headers->add( new Header('Cache-Control', 'no-cache') ); if ($headers->has('accept-encoding')) { echo $headers->get('ACCEPT-ENCODING')->__toString(); // Accept-Encoding: gzip, deflate } foreach ($headers as $header) { /** @var Header $header */ $name = $header->getName(); $values = $header->getValues(); }
Tests
The package includes a set of tests (made with Pest) to ensure that everything is working as expected.
You can run the tests by executing the following command:
./vendor/bin/pest
License
The package is licensed under the MIT license. See License File for more information.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-19