aguimaraes / bureaucrat
Failure is my thing
dev-master / 1.0.x-dev
2017-12-10 02:56 UTC
Requires
- php: ~5.6|~7.0
Requires (Dev)
- phpunit/phpunit: >=5.4.3
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-25 12:56:36 UTC
README
Failure handling for PHP. I would add "elegant" here, but I don't lie.
Don't use it, work in progress.
Install
Via Composer
$ composer require aguimaraes/bureaucrat
Usage
$retry = (new Retry()) ->onlyOnException(\RuntimeException::class) ->atLeast(3) ->withDelay(2, TimeUnit::SECOND) ->abortOnException(\DomainException::class); $circuitBreaker = (new CircuitBreaker()) ->withFailureThreshold(3, 5) ->withSuccessThreshold(4, 5) ->withDelay(20, TimeUnit::SECOND) ->failOnException(\RuntimeException::class) ->failOnTimeOut(1, TimeUnit::MINUTE); $result = (new Failsafe()) ->with($retry) ->and($circuitBreaker) ->run(function() { // ... your thing });
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email alvaroguimaraes@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.