Just announced at Laracon India 2026: Laravel Fuse. It’s a circuit breaker implemented as middleware for Laravel Queue jobs, and it solves a problem all of us working with external services have faced.
The Problem
Imagine this scenario: it’s 11 PM and Stripe is having issues. Your queue workers don’t know this, they keep trying to charge customers, and each job waits 30 seconds before timing out. Then they retry. Wait again. Timeout again.
If you have 10,000 payment jobs in queue and each one waits 30 seconds before failing, you’re looking at more than 25 hours to clear the queue - even though all requests will fail.
Fuse solves this by implementing the circuit breaker pattern. After a configurable number of failures, it stops making requests completely. Jobs fail in milliseconds instead of waiting for timeouts, and are automatically released to the queue for later retry. When the service recovers, Fuse detects it and resumes normal operations.
Installation
composer require harris21/laravel-fuse
Publish the configuration:
php artisan vendor:publish --tag=fuse-config
Basic Usage
Add the middleware to any job that calls an external service:
use Harris21\Fuse\Middleware\CircuitBreakerMiddleware;
class ChargeCustomer implements ShouldQueue
{
public $tries = 0;
public $maxExceptions = 3;
public function middleware(): array
{
return [new CircuitBreakerMiddleware('stripe')];
}
public function handle(): void
{
Stripe::charges()->create([
'amount' => $this->amount,
'currency' => 'usd',
'customer' => $this->customerId,
]);
}
}
Set $tries = 0 for unlimited releases (since released jobs aren’t “retries” in Laravel’s sense), while $maxExceptions = 3 limits real failures.
Circuit Breaker States
CLOSED is normal operation. All requests pass to the external service. In the background, Fuse tracks success and failure rates.
OPEN is protection mode. Once the failure rate exceeds your configured threshold, the circuit opens. Jobs fail immediately - no API call, no 30-second timeout.
HALF-OPEN is recovery test. After a timeout period, Fuse allows one probe request. If successful, the circuit closes. If it fails, the circuit reopens.
Intelligent Failure Classification
Not all errors mean a service is down. If Stripe returns a 429 for rate limits, that’s not an outage - the service is working fine, you’re just sending too many requests.
Fuse only counts failures indicating real service problems:
- Server errors 500, 502, 503 count as failures
- Connection timeouts and refused connections count as failures
- Rate limits 429 do NOT count
- Authentication errors 401 and 403 do NOT count
This prevents false positives.
Peak Hours Support
During business hours, you might want to be more tolerant of failures to maximize successful transactions:
'stripe' => [
'threshold' => 40,
'peak_hours_threshold' => 60,
'peak_hours_start' => 9,
'peak_hours_end' => 17,
],
Conclusion
The circuit breaker pattern is one of those techniques that, when you need it, you really need it. Fuse’s implementation for Laravel is clean, uses the middleware system we already know, and integrates with Laravel’s native tools (cache, events, queue).
For anyone with queued jobs that depend on external services, Fuse is a resilience layer that can prevent a third-party outage from becoming your own system’s outage.








Comments