pear/http2
Composer 安装命令:
composer require pear/http2
包简介
Miscellaneous HTTP utilities
README 文档
README
Static methods for doing miscellaneous HTTP related stuff like date formatting, language negotiation or HTTP redirection.
Features
- Language negotiation
- MIME type negotiation
- Charset negotiation
- Send HEAD requests to URLs
- Make URLs absolute
- Parse HTTP
Link:header values (RFC 5988)
Installation
$ composer require pear/http2
Usage
Language negotiation
Quality factors in the Accept-Language: header are supported, e.g.:
Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8
Code:
<?php
$http = new HTTP2();
$langs = array(
'en' => 'locales/en',
'en-US' => 'locales/en',
'en-UK' => 'locales/en',
'de' => 'locales/de',
'de-DE' => 'locales/de',
'de-AT' => 'locales/de',
);
$neg = $http->negotiateLanguage($langs);
$dir = $langs[$neg];
?>
Charset negotiation
<?php
$http = new HTTP2();
$charsets = array(
'UTF-8',
'ISO-8859-1',
);
$charset = $http->negotiateCharset($charsets);
?>
MIME type negotiation
<?php
$http = new HTTP2();
$contentType = array(
'application/xhtml+xml',
'application/xml',
'text/html',
'text/plain',
);
$mime = $http->negotiateMimeType($contentType);
?>
Links
- Homepage
- http://pear.php.net/package/HTTP2
- Bug tracker
- http://pear.php.net/bugs/search.php?cmd=display&package_name[]=HTTP2
- Documentation
- http://pear.php.net/package/HTTP2/docs
- Unit test status
https://travis-ci.org/pear/HTTP2
- Packagist
- https://packagist.org/packages/pear/http2
pear/http2 适用场景与选型建议
pear/http2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 160.31k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2016 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pear/http2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pear/http2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 160.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 16
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2016-08-10