gonzalo123 / rest-proxy
Simple rest proxy
Installs: 560
Dependents: 0
Suggesters: 0
Security: 0
Stars: 45
Watchers: 9
Forks: 23
Open Issues: 6
Requires
- php: >=5.5.0
- ext-curl: *
- symfony/expression-language: dev-master
- symfony/http-foundation: dev-master
This package is not auto-updated.
Last update: 2024-11-09 14:06:05 UTC
README
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