The circuit-breaker package for Laravel implements the circuit breaker pattern to prevent cascading failures when downstream services are unavailable. It supports three circuit states (closed, open, half-open), named circuits for per-service isolation, lifecycle callbacks (onOpen, onSuccess, onFailure), and Guzzle middleware integration via an X-Circuit-Key header. Service calls are wrapped with a run() method, and the circuit automatically decides whether to allow, block, or test each call based on current state.

2m read timeFrom laravel-news.com
Post cover image
Table of contents
# Circuit State Callbacks# Running Operations# Guzzle Middleware

Sort: