aguimaraes/bureaucrat

失败是我的事情

dev-master / 1.0.x-dev 2017-12-10 02:56 UTC

This package is auto-updated.

Last update: 2024-09-25 12:49:30 UTC


README

Latest Version on Packagist Software License Build Status StyleCI Coverage Status Quality Score Total Downloads

PHP的失败处理。我本来想在这里加上“优雅”,但我不撒谎。

不要使用它,还在开发中。

安装

通过Composer

$ composer require aguimaraes/bureaucrat

用法

$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
    });

变更日志

请参阅变更日志以获取最近更改的更多信息。

测试

$ composer test

贡献

请参阅贡献指南行为准则以获取详细信息。

安全

如果您发现任何安全相关的问题,请通过alvaroguimaraes@gmail.com 发送电子邮件,而不是使用问题跟踪器。

致谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件