softonic/guzzle-proxybonanza-middleware

This package is abandoned and no longer maintained. No replacement package was suggested.

This package allows you to use proxybonanza transparently in guzzle.

0.0.1 2018-08-06 13:19 UTC

This package is auto-updated.

Last update: 2020-01-17 17:20:20 UTC


README

Deprecated in favor of softonic/guzzle-proxy-middleware. The new package allows any proxy instead of just proxybonanza.

Guzzle Proxy Bonanza Middleware

Latest Version Software License Build Status Total Downloads

This package provides middleware for guzzle for handling proxy connection using proxy bonanza.

Installation

To install, use composer:

composer require softonic/guzzle-proxybonanza-middleware

Usage

To use this middleware, you need to initialize it like:

$proxyManager = new ProxyManager(
    new Proxy(
        new GuzzleClient(),
        $cache, // A PSR-6 item pool cache.
        '<YOUR-USER-PACKAGE-ID>',
        '<YOUR-API-KEY>'
));

And inject it to Guzzle with somethine like:

$stack = new HandlerStack();
$stack->setHandler(new CurlHandler());
$stack->push($proxyManager);
$guzzleClient = new GuzzleClient(['handler' => $stack]);

From now on every request sent with $guzzleClient will be done using a random proxy from your proxy list.

Testing

softonic/guzzle-proxybonanza-middleware has a PHPUnit test suite and a coding style compliance test suite using PHP CS Fixer.

To run the tests, run the following command from the project folder.

$ docker-compose run test

To run interactively using PsySH:

$ docker-compose run psysh

License

The Apache 2.0 license. Please see LICENSE for more information.