PHP code example of rymanalu / laravel-circuit-breaker
1. Go to this page and download the library: Download rymanalu/laravel-circuit-breaker 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/ */
rymanalu / laravel-circuit-breaker example snippets
use CircuitBreaker;
/**
* Get the number of failures for the given key.
*
* @param string $key
* @return int
*/
CircuitBreaker::failures($key);
/**
* Reset the number of failures for the given key.
*
* @param string $key
* @return bool
*/
CircuitBreaker::resetFailures($key);
/**
* Increment the counter for a given key for a given decay time.
*
* @param string $key
* @param float|int $decayMinutes
* @return int
*/
CircuitBreaker::track($key, $decayMinutes = 1);
/**
* Determine if the given key has too many failures.
*
* @param string $key
* @param int $maxFailures
* @param int $decayMinutes
* @return bool
*/
CircuitBreaker::tooManyFailures($key, $maxFailures, $decayMinutes = 1);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.