Welcome

Welcome

Fuse is a circuit breaker for PHP 8.2+. You wrap a call that talks to another system. When that system starts failing, Fuse stops calling it for a short time, then lets a few trial calls through to see if it has recovered.

The breaker does not know about HTTP clients. You pass it a callable. Optional adapters cover Saloon connectors and Laravel applications. Each adapter is independent, so the package runs with neither, with either, or with both.

What you get

  • Three states: closed, open, and half-open.
  • A failure window, so a handful of old errors does not open the circuit forever.
  • Half-open probes, so recovery is tested with a few calls instead of a flood.
  • Pluggable storage: memory, Laravel cache, a database table, or any PSR-16 cache.
  • CircuitOpenException when a call is rejected, with storage key and approximate retry-after.
  • FuseFactory for shared store, named breaker overrides, and events outside Laravel.
  • State-change events (CircuitOpened, CircuitClosed, CircuitHalfOpened) for logs and alerts.
  • Optional Saloon traits, Laravel facade / fuse() helper, Artisan commands, and PHPUnit helpers.

Where to go next

You want to… Read
Install it Installation
Understand the states How it works
Call it from plain PHP Plain PHP
Use it in Laravel Laravel
Protect a Saloon connector Saloon
Laravel + Saloon together Laravel and Saloon
Listen when a circuit opens Events
See every combination, end to end Scenarios
Write tests Testing

Start with How it works if the words closed, open, and half-open are new. Start with Installation if you already know circuit breakers and want the package in a project.

Edit this page