2017 © Pedro Peláez
 

library proxy

Middleware to forward requests and return responses

image

middlewares/proxy

Middleware to forward requests and return responses

  • Saturday, January 27, 2018
  • by oscarotero
  • Repository
  • 1 Watchers
  • 5 Stars
  • 613 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 5 Versions
  • 18 % Grown

The README.md

middlewares/proxy

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

Middleware to create a http proxy using Guzzle., (*2)

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/proxy., (*3)

composer require middlewares/proxy

Example

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

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

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

Usage

You need a Psr\Http\Message\UriInterface with the target of the proxy., (*4)

use Middlewares\Utils\Dispatcher;
use Middlewares\Utils\Factory;

$target = Factory::createUri('http://api.example.com');

Dispatcher::run([
    new Middlewares\Proxy($target)
]);

client

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

$target = Factory::createUri('http://api.example.com');
$client = new Client();

$proxy = (new Middlewares\Proxy($target))->client($client);

options

Options passed to the guzzle client. See the guzzle documentation for more information, (*6)


Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*7)

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

The Versions

27/01 2018
21/09 2017
08/04 2017