endpot/php-rest-proxy
Composer 安装命令:
composer require endpot/php-rest-proxy
包简介
A php rest proxy script based on guzzle
README 文档
README
About
This project is aimed to ultilize a rest proxy with php basing on Guzzle. Up to now, the script works fine for the most common request method (GET/POST/PUT/DELETE/OPTIONS). When data is submitted with POST method and contain multipart/form-data content, the script would create a new MultipartStream with global constant $_POST and $_FILES, and then transfer to target uri. The script also supports simple middleware within which you can deal with the request/response.
关于
该项目基于Guzzle实现请求的转发,包括但不限于GET/POST/PUT/DELETE/OPTIONS等方法。当请求方法为POST,且内容类型为multipart/form-data时,由于PHP的特性,从php://input中获取不到原始的数据,脚本会解析POST和FILES数组生成MultipartStream,再进行转发。该脚本还支持简单的中间件,分别作用于请求转发前后,对请求和响应进行处理。
Installation
Install using composer:
composer require endpot/php-rest-proxy
Example
// create proxy instance $proxy = new \Proxy\Proxy(); // set target url $targetUrl = 'http://httpbin.org/'; // create psr7 request based on the global parameters $request = $proxy->fromGlobals(); // add middlewares // forward request to target $response = $proxy->addMiddleware('ExampleMiddleware') ->forward($request) ->to($targetUrl); // get and show the response echo $response->getBody();
License
It is open-sourced software licensed under the MIT license.
endpot/php-rest-proxy 适用场景与选型建议
endpot/php-rest-proxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 831 次下载、GitHub Stars 达 10, 最近一次更新时间为 2017 年 10 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 endpot/php-rest-proxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 endpot/php-rest-proxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 831
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-22