middlewares/proxy

Middleware to forward requests and return responses


Keywords
http, server, middleware, psr-7, psr-15, proxy
License
MIT

Documentation

middlewares/proxy

Latest Version on Packagist Software License Build Status Quality Score Total Downloads SensioLabs Insight

Middleware to create a http proxy using Guzzle.

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/proxy.

composer require middlewares/proxy

Example

$target = new Uri('http://api.example.com');

$dispatcher = new Dispatcher([
	new Middlewares\Proxy($target)
]);

$response = $dispatcher->dispatch(new ServerRequest());

Options

__construct(Psr\Http\Message\UriInterface $uri)

The target of the proxy.

client(GuzzleHttp\ClientInterface $client)

Instance of the client used to execute the requests. If it's not provided, an instance of GuzzleHttp\Client is created automatically.

options(array $options)

Options passed to the guzzle client. See the guzzle documentation for more information


Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.