PHPackages                             monkeyphp/circuit-breaker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. monkeyphp/circuit-breaker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

monkeyphp/circuit-breaker
=========================

PHP implementation of the circuit breaker pattern

261PHP

Since Mar 19Pushed 12y ago1 watchersCompare

[ Source](https://github.com/monkeyphp/circuit-breaker)[ Packagist](https://packagist.org/packages/monkeyphp/circuit-breaker)[ RSS](/packages/monkeyphp-circuit-breaker/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Circuit Breaker
===============

[](#circuit-breaker)

PHP implementation of the Circuit Breaker pattern

A CircuitBreaker is an production pattern, described by Robert T Nygard in his seminal book 'Release It!' \[insert amazon link here\].

It is a defensive pattern aimed at reducing and eliminating the risk of any integration point within your application, such as third party web service; from affecting the rest of your application.

For example, if your application requires a call to be made to a third party api that is out of the scope of your control, and that service begins to respond slowly to requests made to it; this can slow down the responsiveness of your application in servicing client requests. This in turn can create a cascading failure in your application that may lead to complete failure.

The CircuitBreaker works by monitoring the integration point, in the case of this library by passing requests and responses to a Policy object.

States
------

[](#states)

A circuit breaker can be in one of three states:

- Open
- Half-open
- Closed

Policy Object
-------------

[](#policy-object)

The Policy object can determine if the request is allowed to pass through to the integration point or not. It also is used to inspect the responses from the third party integration and may then decide to prevent and further requests to be allowed to pass through to the integration point.

The Policy instance must only implement two methods `request` and `response` and only needs to return a boolean.

In the case of `request` the returned boolean will determine if the CircuitBreaker should continue to pass the request on to the integration.

In the case of `response` the returned boolean is used to determine if the CircuitBreaker should return an `OpenException` to the calling client.

```

$service = new CircuitBreaker(new FlakeyService(), new PolicyProvider());

$response = $myService->doSomething($request);

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc2ab20dc9cef0e2318a63df0ab2407c5914beb0cca5095443d3fe477dc17cce?d=identicon)[MonkeyPHP](/maintainers/MonkeyPHP)

---

Top Contributors

[![monkeyphp](https://avatars.githubusercontent.com/u/1448153?v=4)](https://github.com/monkeyphp "monkeyphp (11 commits)")

### Embed Badge

![Health badge](/badges/monkeyphp-circuit-breaker/health.svg)

```
[![Health](https://phpackages.com/badges/monkeyphp-circuit-breaker/health.svg)](https://phpackages.com/packages/monkeyphp-circuit-breaker)
```

###  Alternatives

[rmrevin/yii2-comments

Comments module for Yii2

5130.8k](/packages/rmrevin-yii2-comments)[easyswoole/verifycode

21102.4k4](/packages/easyswoole-verifycode)[svanderburg/composer2nix

Generate Nix expressions to build PHP composer packages

925.5k](/packages/svanderburg-composer2nix)[jolicode/seo-override

Override your seo markup on the fly

1462.4k](/packages/jolicode-seo-override)[docomoinnovations/cloud_orchestrator

Cloud orchestrator distribution by DOCOMO Innovations, Inc.

108.4k](/packages/docomoinnovations-cloud-orchestrator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
