yurun
V2EX  ›  PHP

ApiAgent v1.0.1 发布 跨域接口代理+接口合并请求

  •  
  •   yurun · Oct 10, 2017 · 3085 views
    This topic created in 3141 days ago, the information mentioned may be changed or developed.

    历时 4 个月,ApiAgent 终于自豪的发布了 1.0 版本。

    ApiAgent 是一个使用 PHP 开发的 API 接口代理程序,支持跨域接口代理和接口合并请求功能。ApiAgent 不光是一个接口代理项目,也可以作为类库使用。

    开发 ApiAgent 的原因是受到了这篇文章的启发: http://www.jianshu.com/p/07293e4825d0

    然后正好工作中也遇到了接口方服务器在海外,国内调用访问速度极差的问题。后来搞了台香港服务器跑 ApiAgent,把这个问题给轻松解决了。

    后来也有在一些项目中使用,不断完善,最后我们看到的 1.0 版就出来啦!

    相对于 v0.x 版更新内容:

    接口代理

    新增智能压缩支持

    新增 return_cookie 参数设置跨域接口代理是否返回 cookie

    修复因 Accept-Encoding 问题乱码

    接口合并

    新增接口设置 json 返回头

    新增支持设置 header

    新增返回 header

    新增智能压缩支持

    新增验证出错时返回 message

    新增返回状态码

    新增 getDataType 和 bodyDataType 参数(移除 dataType 参数)

    新增返回请求耗时,单位为秒

    调整不再从 header 返回 cookie,改为结果集中返回

    修复因 Accept-Encoding 问题乱码

    修复合并请求失败时 data 为 false 的问题,现在不会出现 data 对应的 key

    修复 getData 有时不生效问题

    代码仓库: https://gitee.com/yurunsoft/apiagent

    Composer:

    
    {
    
        "require": {
    
            "yurunsoft/api-agent": "1.0.*"    }
    
    }
    
    

    文档地址: http://doc.yurunsoft.com/ApiAgent

    2 replies    2017-10-11 08:56:25 +08:00
    shoaly
        1
    shoaly  
       Oct 10, 2017
    文档里面毛都没有.... 采用先挖坑后填的策略么
    思路不错, 好评
    yurun
        2
    yurun  
    OP
       Oct 11, 2017
    文档里有内容啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1024 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 23:04 · PVG 07:04 · LAX 16:04 · JFK 19:04
    ♥ Do have faith in what you're doing.