- How do I install algoyounes/circuit-breaker in a Laravel app?
- Install it with Composer using composer require algoyounes/circuit-breaker, then let Laravel package discovery register the service provider automatically. The package exposes a publishable configuration file so you can set thresholds and fallback behavior per integration. Run your normal config cache step after publishing so the settings are picked up in production.
- Does this package support Laravel 13?
- Yes, version 1.8.1 explicitly adds Laravel 13 support and removes it as a compatibility blocker. That release is a patch, so no breaking API changes are called out in the notes. You should still confirm the PHP version and transitive dependency constraints match your application matrix before rolling it into a Laravel 13 upgrade.
- How do I configure circuit breaker thresholds and timeouts?
- Thresholds and fallbacks are configurable through the package configuration rather than hard-coded in your service classes. Publish the config file and define failure thresholds, recovery behavior, and the fallback path for each protected dependency. Keep the configuration in version control so threshold changes are reviewed like any other production setting.
- Which cache store should I use for multi-node Laravel deployments?
- Because circuit state must be shared across application instances, a shared store such as Redis is the sensible choice for multi-node deployments. A local file or array cache would give each node its own breaker state and undermine the protection. Validate how your chosen cache backend behaves under concurrency before relying on it for critical integrations.
- How does the half-open state work and how are retry storms limited?
- The circuit breaker pattern trips after repeated errors, then allows limited probe requests while half-open before closing again on success. The package supports configurable thresholds and fallbacks to shape that behavior. Verify the exact half-open probe and retry-limiting semantics in your staging pilot, since this is the area most worth testing against your traffic patterns.
- Can I define a fallback when the circuit is open?
- Yes, the package supports configurable fallbacks so requests can degrade gracefully instead of failing hard when a dependency is down. Define the fallback per integration and make sure it is testable, since a silently incorrect fallback can be worse than a clear error. The TPM assessment recommends adopting the package only where you have a defined fallback path.
- Are circuit state transitions observable through events, logs, or metrics?
- Observability is listed as an open question in the technical assessment, so treat it as something to confirm rather than assume. Instrument state transitions, rejections, and fallback outcomes yourself during the pilot, for example by wrapping the breaker calls or listening for any events the package dispatches. Dashboards and alerts for open-circuit incidents should exist before you adopt it on critical paths.
- Is the package compatible with queues and Laravel Octane?
- Queue and Octane compatibility are flagged as items to validate in your own application matrix rather than guaranteed by the release notes. Because Octane keeps long-lived workers, confirm that circuit state is read from the shared cache instead of being held in memory per worker. Test a queued job path and an Octane worker path in staging before production rollout.
- How do I test circuit breaker behavior in my Laravel test suite?
- Fallback behavior and state transitions should be covered in CI alongside your current Laravel version and Laravel 13. Use a controllable cache store in tests so you can simulate open, half-open, and closed states without real network failures. Add smoke tests for the protected integration so a tripped circuit does not silently change response contracts.
- Is algoyounes/circuit-breaker production ready for critical integrations?
- It is best treated as a pilot-first package: adopt ^1.8.1 in a non-critical integration, publish configuration, and use a shared cache store such as Redis before expanding. It is not a substitute for domain-level error handling, and the maintainer support model appears community-driven. Define internal ownership, a runbook, and an escalation path for open-circuit incidents before using it on critical paths.