arthurh/rest-proxifier 问题修复 & 功能扩展

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

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

arthurh/rest-proxifier

Composer 安装命令:

composer require arthurh/rest-proxifier

包简介

proxy your rest api

README 文档

README

The goal of this project is to proxy your rest api.

Why do this?

First, it was initialized when I found that some rest api doesn't handle CORS.

This project will reinject CORS headers for angularjs project for example.

This project will also cache response for read request.

NOTE: Rest-proxifier use pathinfo so set your web server to use it.

NOTE2: This project is Cloud Foundry Ready, so you can also use it inside Cloud Foundry to handle uaa rest api for example.

Installation

Through Composer, obviously:

$ composer create-project arthurh/rest-proxifier path/

How to use

You can use rest-proxifier in multiple ways:

  • Proxy from cnnfig file
  • Proxy from CloudFoundry Services if you use CloudFoundry
  • Proxy from database entries

Theses 3 ways can be used in same time, there is no limit.

For simple use, look at config/default.yml:

proxyfy:
  - api: http://example.com
    route: /api
    #this is optionnal
    #request-header:
    #  header-key: header-value
    #response-header:
    #  header-key: header-value
    #response-content: ~
admin-ui: true #set to false to remove admin interface
admin-ui-root: /admin #path to admin ui
rewriting: false #set to true if you use rewriting to point directly on index.php
caching-time: 20 minutes #set to false to remove caching
log-request: true #set to false to stop logs user request to proxify
database: false #or uri to database, e.g: mysql://root:password@localhost/mydb or special uri for sqlite: sqlite:/path, this is optionnal

This file can be rewrite in json or in xml too, it uses this dependency noodlehaus/config so follow schemas from this dependency if you don't want use yaml.

For this default config there is an example, a route is already set.

What you should do to try is to go to http://<my hostname>/index.php/api and rest-proxifier will respond the page http://example.com with CORS headers.

If you do http://<my hostname>/index.php/api/other/verb/for/api rest-proxifier will respond http://example.com/other/verb/for/api.

Admin interface

By default you have an interface located on http://<my hostname>/index.php/admin.

You can use it to add more proxy only on a database.

Proxies from config file can't be modify with this interface with the goal make accessible all the time theses proxies.

For Cloud Foundry user

This part is only for people who use the Cloud Foundry PaaS.

You can create a service which contain proxy (use regex to find service) in his name with this json value for example:

[
    {
      "api": "http://example.com",
      "route": "/api"
    }
]

And rest-proxifier will auto-bind to this service

You can also create a database service which should contains at least one of theses values in its name (use regex to find service):

  • my (for mysql)
  • db
  • database
  • oracle
  • oci
  • postgres
  • pgsql
  • maria

And rest-proxifier will auto-bind database to this service

arthurh/rest-proxifier 适用场景与选型建议

arthurh/rest-proxifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「http」 「rest」 「api」 「https」 「proxy」 「proxy-rest」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 arthurh/rest-proxifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 arthurh/rest-proxifier 我们能提供哪些服务?
定制开发 / 二次开发

基于 arthurh/rest-proxifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-09