ServerAction to create a http proxy using Guzzle.
$target = new Uri('http://api.example.com');
$proxy = new HMS\Proxy($target);
$response = $proxy(new ServerRequest());
// index.php
use HMS\Proxy;
use Zend\Diactoros\Uri;
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->any('/{_:.*}', new Proxy(new Uri('http://httpbin.org')));
$app->run();
# run built-in web server
$ php -S localhost:8000
# open your browser
$ xdg-open http://localhost:8000
The target of the proxy.
Instance of the client used to execute the requests. If it's not provided, an instance of GuzzleHttp\Client
is created automatically.
Options passed to the guzzle client. See the guzzle documentation for more information
The MIT License (MIT). Please see LICENSE for more information.