PHPackages                             lukaszaleckas/laravel-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. lukaszaleckas/laravel-circuit-breaker

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

lukaszaleckas/laravel-circuit-breaker
=====================================

00[1 PRs](https://github.com/lukaszaleckas/laravel-circuit-breaker/pulls)PHP

Since Feb 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lukaszaleckas/laravel-circuit-breaker)[ Packagist](https://packagist.org/packages/lukaszaleckas/laravel-circuit-breaker)[ RSS](/packages/lukaszaleckas-laravel-circuit-breaker/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Circuit Breaker
=======================

[](#laravel-circuit-breaker)

> Circuit breaker is a design pattern used in software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system difficulties.

Source: [Wikipedia](https://en.wikipedia.org/wiki/Circuit_breaker_design_pattern)

Further explanation
-------------------

[](#further-explanation)

Let's explain what this does using an example, as they are much better than definitions, in my opinion.

Let's say you have two microservices `A` and `B`:

1. You are calling microservice `B` from `A` and have a 30s timeout configured.
2. `B` fails to respond and you receive a timeout error.
3. You keep getting requests to `A` and keep failing with a timeout from `B`.
4. Request queue of `A` gets filled up.
5. Requests to `A` start to timeout.

In this case it would be much better to track request failures from `A` to `B` and return an error immediately.

Circuit Breaker pattern does just that - on `A` you are tracking request failures to `B` and if failure count, in the particular time window, exceeds threshold, you skip doing those requests and return an error immediately.

Installation
------------

[](#installation)

1. Run:

```
composer require lukaszaleckas/laravel-circuit-breaker

```

Service provider should be automatically registered, if not add

```
LaravelCircuitBreaker\CircuitBreakerServiceProvider::class
```

to your application's `app.php`.

2. Publish `circuit-breaker.php` config file:

```
    php artisan vendor:publish --tag=circuit-breaker

```

Usage
-----

[](#usage)

Inject `LaravelCircuitBreaker\CircuitBreakerService` through constructor.

Use `getCircuitBreaker` with service name passed as a parameter to get a circuit breaker instance.

Method usage:

- Use `isClosed` in your, for example, HTTP client to determine if requests can be made.
- Use `registerFailure` when you receive an error.
- Use `registerSuccess` when you receive a success response. This is used to close the circuit when/if it's half open.

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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/30416654c84b25a433b4c1c5360c8fac347b923247750b19a0310e45dc4aa5f4?d=identicon)[lukaszaleckas](/maintainers/lukaszaleckas)

---

Top Contributors

[![lukaszaleckas](https://avatars.githubusercontent.com/u/47445386?v=4)](https://github.com/lukaszaleckas "lukaszaleckas (2 commits)")

### Embed Badge

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

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

###  Alternatives

[codenco-dev/nova-grid-system

A Laravel Nova tool to have a grid system

81358.0k](/packages/codenco-dev-nova-grid-system)[opensolutions/oss-snmp

A PHP SNMP library for people who hate SNMP, MIBs and OIDs!

10925.1k](/packages/opensolutions-oss-snmp)[tabgeo/country

geoip (only countries) php library (http://tabgeo.com)

1161.2k](/packages/tabgeo-country)

PHPackages © 2026

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