PHP code example of ksaveras / guzzle-circuit-breaker-middleware
1. Go to this page and download the library: Download ksaveras/guzzle-circuit-breaker-middleware library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ksaveras / guzzle-circuit-breaker-middleware example snippets
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Ksaveras\GuzzleCircuitBreakerMiddleware\CircuitBreakerMiddleware;
// $factory is instance of CircuitBreakerFactory
$middleware = new CircuitBreakerMiddleware($factory->create('CB Name'));
$handlerStack = HandlerStack::create();
$handlerStack->push($middleware);
$client = new Client(['handler' => $handlerStack]);