Download the PHP package alex97lewis/laravel-circuit-breaker without Composer
On this page you can find all versions of the php package alex97lewis/laravel-circuit-breaker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alex97lewis/laravel-circuit-breaker
More information about alex97lewis/laravel-circuit-breaker
Files in alex97lewis/laravel-circuit-breaker
Package laravel-circuit-breaker
Short Description A simple, drop-in circuit breaker implementation for Laravel applications with Redis caching and Artisan commands
License MIT
Homepage https://github.com/alex97lewis/laravel-circuit-breaker
Informations about the package laravel-circuit-breaker
Laravel Circuit Breaker
A simple, elegant circuit breaker implementation for Laravel applications with Redis caching and comprehensive Artisan command support.
Features
- 🔄 Three States: Closed, Open, Half-Open with automatic transitions
- ⚡ Redis-Powered: Fast, reliable caching with Laravel's Redis integration
- 🎛️ Configurable: Failure thresholds, recovery timeouts, and more
- 📝 Auto-Logging: Comprehensive failure logging with context
- 🛠️ Artisan Commands: Test, monitor, and manage circuit breakers via CLI
- 🔍 Dynamic Discovery: No hardcoded circuit breaker names
- 🎨 Laravel Integration: Facades, helpers, and service container ready
- 📦 Zero Dependencies: Uses only Laravel's built-in components
Installation
Install via Composer:
The package will automatically register itself via Laravel's package discovery.
Publish Configuration (Optional)
Usage
Basic Usage
Using Helper Functions
Using Facade
Configuration
Environment variables:
CIRCUIT_BREAKER_FAILURE_THRESHOLD=5
- Failures before openingCIRCUIT_BREAKER_RECOVERY_TIMEOUT=60
- Seconds before retryCIRCUIT_BREAKER_TIMEOUT=30
- Operation timeoutCIRCUIT_BREAKER_LOG_FAILURES=true
- Log failures
States
- Closed: Normal operation
- Open: Failing fast, rejecting calls
- Half-Open: Testing if service recovered
Features
- ✅ Zero dependencies (uses Laravel Cache)
- ✅ Named circuit breakers for different services
- ✅ Configurable thresholds and timeouts
- ✅ Automatic logging
- ✅ Helper functions and facade
- ✅ Drop-in modular design
- ✅ Built-in Artisan commands for testing and management
Artisan Commands
The module includes several Artisan commands for testing and managing circuit breakers:
Test Circuit Breaker
Test a circuit breaker with simulated failures.
Check Status
Show the status of a specific circuit breaker or all circuit breakers.
Reset Circuit Breaker
Reset a circuit breaker to closed state or reset all circuit breakers.
All versions of laravel-circuit-breaker with dependencies
illuminate/cache Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/redis Version ^10.0|^11.0|^12.0