softonic / guzzle-proxybonanza-middleware
This package allows you to use proxybonanza transparently in guzzle.
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.3
- psr/cache: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.4
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.10.1
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^3
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
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.