RestProxy
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src according to sbuckpesch May 1, 2015
tests refactors + psr-4 + new travis conf Nov 14, 2014
www clean May 1, 2015
.gitignore refactors + psr-4 + new travis conf Nov 14, 2014
.travis.yml refactors + psr-4 + new travis conf Nov 14, 2014
README.md dummy server Aug 8, 2012
composer.json
composer.lock
phpunit.xml refactors + psr-4 + new travis conf Nov 14, 2014

README.md

rest-proxy Build Status

Simple Rest Proxy

Example

<?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();

How to install:

Install composer:

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

Create a new project:

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

Run dummy server (only with PHP5.4)

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

Open a web browser and type: http://localhost:8888/github/users/gonzalo123