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

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

gabrielanhaia/laravel-circuit-breaker
=====================================

Laravel integration for PHP Circuit Breaker — multiple storage drivers, middleware, Artisan commands, and event system

v2.0.0(4mo ago)491.9k↑311.8%3MITPHPPHP ^8.2CI failing

Since Jul 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/gabrielanhaia/laravel-circuit-breaker)[ Packagist](https://packagist.org/packages/gabrielanhaia/laravel-circuit-breaker)[ Docs](https://github.com/gabrielanhaia/laravel-circuit-breaker)[ RSS](/packages/gabrielanhaia-laravel-circuit-breaker/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

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

[](#laravel-circuit-breaker)

[![CI](https://github.com/gabrielanhaia/laravel-circuit-breaker/actions/workflows/ci.yml/badge.svg)](https://github.com/gabrielanhaia/laravel-circuit-breaker/actions)[![Latest Stable Version](https://camo.githubusercontent.com/fa00bf838992ab57c9622148fc8282a7fb3051bfea6f4881fc87f459f5b1230e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c616e686169612f6c61726176656c2d636972637569742d627265616b65722e737667)](https://packagist.org/packages/gabrielanhaia/laravel-circuit-breaker)[![PHP Version](https://camo.githubusercontent.com/e92d9f01732f13f82f78d5e8fe19ee0d85c25c5746a81c873a74f69a85e9f3a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6761627269656c616e686169612f6c61726176656c2d636972637569742d627265616b65722e737667)](https://packagist.org/packages/gabrielanhaia/laravel-circuit-breaker)[![Laravel Version](https://camo.githubusercontent.com/f5eb9bc1086db5f00cc8e07ae30e1d21de45ed43c186c14e430c05bca50553a7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31312e7825323025374325323031322e782d6f72616e67652e737667)](https://packagist.org/packages/gabrielanhaia/laravel-circuit-breaker)[![License](https://camo.githubusercontent.com/a5d6ff6257cdac1e99105b917beedd562b8530cc163779c59a59c49d2ed25cc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6761627269656c616e686169612f6c61726176656c2d636972637569742d627265616b65722e737667)](LICENSE)[![Buy me a coffee](https://camo.githubusercontent.com/52a20eebd71e6a955fb0654799a6f57d270f132a77ffc82ba6251b1673316682/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275792532306d6525323061253230636f666665652d646f6e6174652d79656c6c6f772e737667)](https://www.buymeacoffee.com/gabrielanhaia)

 [![Logo - Laravel Circuit Breaker](./logo.png)](./logo.png)

A Laravel integration for [PHP Circuit Breaker](https://github.com/gabrielanhaia/php-circuit-breaker) v3 with multiple storage drivers, HTTP middleware, Artisan commands, and full event system integration.

What Is a Circuit Breaker?
--------------------------

[](#what-is-a-circuit-breaker)

When your application calls an external service (payment gateway, email API, etc.), that service can become slow or unresponsive. Without protection, your application keeps sending requests — piling up timeouts, wasting resources, and degrading user experience.

A **circuit breaker** monitors failures and automatically stops calling a failing service, giving it time to recover. It works like an electrical circuit breaker: when too many failures occur, the circuit "opens" and all requests fail fast without actually hitting the remote service.

 ```
stateDiagram-v2
    [*] --> Closed
    Closed --> Open : Failures reach threshold
    Open --> HalfOpen : Timeout expires
    HalfOpen --> Closed : Success threshold met
    HalfOpen --> Open : Any failure
```

      Loading StateBehaviour**Closed**Normal operation. Requests pass through. Failures are counted.**Open**Requests are blocked immediately (fail fast). No calls reach the service.**Half-Open**A limited number of probe requests are allowed through to test recovery.Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^11.0 or ^12.0
- [gabrielanhaia/php-circuit-breaker](https://github.com/gabrielanhaia/php-circuit-breaker) ^3.0 (installed automatically)

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

[](#installation)

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

Publish the configuration file:

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

Configuration
-------------

[](#configuration)

After publishing, the config lives at `config/circuit_breaker.php`.

### Storage Driver

[](#storage-driver)

Choose where circuit state is persisted:

```
