sekjun9878/request-parser
Composer 安装命令:
composer require sekjun9878/request-parser
包简介
A library to parse raw HTTP requests for PHP CLI web servers and more.
README 文档
README
RequestParser is a PHP library for parsing raw HTTP requests.
This library is not a complete to-specification implementation of the HTTP/1.1 protocol (because doing that would be extremely difficult and unnecessary), but implements most of the spec and should be good enough for the purposes of a specific-purpose HTTP server such as an API server for a PHP CLI application.
If in doubt, try it and see if it works for your purpose! But don't come knocking on my door if you accidentally manage to blow up your back yard... somehow.
Features
- Easy to use
- Unit tested
- Comes in both Composer and PHAR versions
- Supports Transfer-Encoding: Chunked
- Batteries included!
- We provide examples for you to copy paste and,
- We return a default Request object for you to use instantly
Examples
Here is a quick example to demonstrate how easy it is to instantly get started:
$requestParser = new RequestParser;
$requestParser->addData("GET /democracy/init HTTP/1.1\r\nUser-Agent: The Illuminati/2.0\r\nContent-Length: 10\r\n\r\nOver 9000!");
$request = Request::create($requestParser->exportRequestState());
var_dump($request->getHeaders());
var_dump($request->getPOST());
You can find more examples in the examples/ folder. The library is simple enough to use
straight away without a documentation, but one is coming soon hopefully.
Installation
Composer
request-parser is PSR-4 compliant and can be installed using Composer. Simply add sekjun9878/request-parser to your composer.json file. Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects.
{
"require": {
"sekjun9878/request-parser": "~1.0"
}
}
or
php composer.phar require sekjun9878/request-parser ~1.0
PHAR
A PHP Archive (or .phar) file is available for downloading. Simply download the .phar, drop it into your project, and include it like you would any other php file. This method is ideal for smaller projects, one off scripts, and quick API hacking.
require_once(__DIR__."/request-parser.phar");
Downloads
For installation, see the installation notes above.
Download latest stable request-parser.phar here. Download latest master request-parser.phar here.
Additional links:
API to return the URL to download the latest master build from: https://www.michael.yoo.id.au/projects/request-parser/api/latest-build-url.php
License
Copyright (c) 2014 Michael Yoo <michael@yoo.id.au>
Released under the MIT license; see LICENSE
https://github.com/sekjun9878/request-parser
This project contains portions of source code from other projects; see LICENSE.
sekjun9878/request-parser 适用场景与选型建议
sekjun9878/request-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.31k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2014 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「http」 「parse」 「request」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sekjun9878/request-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sekjun9878/request-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sekjun9878/request-parser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
yii2 xml request parser
repository php library
Parse promotion arrays from the Wayne State University API
Parse use statements for a reflection object
HTTP request logger middleware for Laravel
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
统计信息
- 总下载量: 7.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-30