frdl/proxy
Composer 安装命令:
composer require frdl/proxy
包简介
php proxy scripts
README 文档
README
Simple Php Proxy based on Guzzle.
Installation
Use Composer...
composer require frdl/proxy
...or the Webfan Installer if you would like to build a larger project.
Usage
<?php use frdl\Proxy\Proxy; require 'vendor/autoload.php'; $proxy = (new Proxy(null, $_SERVER['REQUEST_URI'], 'green.example.com', //target host $_SERVER['HTTP_HOST'], //User Input, forward optionaly* $_SERVER['REQUEST_METHOD'], 'https', false)) ->withFakeHost(true) //*Do overwrite/not use users host header //...or... ->withFakeHeader('X-Forwarded-Host') ; $proxy->handle(true);
Internally the proxy ignores the bounce-detection silently to fallback to any localhost scripts.
You can use it before/without handling the HTTP-Forwarding, e.g. to perform a (test-)request on the same host.
<?php if(!$proxy->bounce()){ $proxy = (new Proxy('blue', $_SERVER['REQUEST_URI'], 'blue.example.com', //target host 'example.com', //set the host header on the target script $_SERVER['REQUEST_METHOD'], 'https', true)) ->handle(true); }
Cache
Built in cache feature:
composer require doctrine/cache
$proxy->withCacheDir(string $dir = null, int $ttl= 1800, bool $force=true)
frdl/proxy 适用场景与选型建议
frdl/proxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 frdl/proxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 frdl/proxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-16