gonzalo123/rest-proxy

此软件包最新版本(dev-master)没有提供许可信息。

简单的REST代理

dev-master / 1.0.x-dev 2015-05-01 16:02 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:33:33 UTC


README

简单REST代理

示例

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use Symfony\Component\HttpFoundation\Request;

use RestProxy\RestProxy;
use RestProxy\CurlWrapper;

$proxy = new RestProxy(
    Request::createFromGlobals(),
    new CurlWrapper()
    );
$proxy->register('github', 'https://api.github.com');
$proxy->run();


foreach($proxy->getHeaders() as $header) {
    header($header);
}
echo $proxy->getContent();

如何安装

安装composer

curl -s https://getcomposer.org/installer | php

创建新项目

php composer.phar create-project gonzalo123/rest-proxy proxy

运行模拟服务器(仅限PHP5.4)

cd proxy
php -S localhost:8888 -t www/

打开网页浏览器并输入: https://:8888/github/users/gonzalo123