endpot/php-rest-proxy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

统计信息

  • 总下载量: 831
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固