Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Circuit Breaker Php Laravel Package

leocarmo/circuit-breaker-php

A circuit breaker implementation for PHP that protects applications from cascading failures by monitoring failing dependencies and temporarily blocking calls until they recover. Configure thresholds, timeouts, and storage adapters to build resilient service integrations.

Deep Wiki
Context7

Product Decisions This Supports

  • Reliability roadmap prioritization. Circuit breaking converts "a third-party outage takes down our product" into "a third-party outage degrades one feature." That directly informs whether resilience work earns roadmap capacity ahead of net-new features — especially for money-path dependencies (payments, tax, shipping, identity, email/SMS, AI/LLM providers).
  • Build vs. buy (vs. borrow). This package is the "borrow" option for a well-known, well-specified pattern. It lets you avoid hand-rolling failure counters, thresholds, and half-open probes inside application code, and it avoids standing up a service-mesh or resilience platform for a single monolith or a handful of services.
  • Defining graceful-degradation product behavior. Adopting a breaker forces explicit product decisions that are otherwise deferred to incidents: do we serve cached/stale data, hide a module, queue-and-retry, fall back to a secondary vendor, or surface an error? Each breaker is effectively a documented product decision about what "degraded" looks like.
  • Incident severity and SLA/SLO design. Breaker trip events are a clean, low-cardinality signal for "dependency is unhealthy." That feeds error budgets, on-call runbooks, and status-page copy — a cheap input to SLO definitions before you invest in a full observability stack.
  • Vendor and integration risk assessment. A per-dependency breaker makes concentration risk visible (how many critical paths depend on one vendor) and gives you a cheap way to run dual-vendor or canary experiments without exposing all traffic to an unproven integration.
  • Scoping platform work. If the team needs only per-dependency breakers in a PHP/Laravel service, this is a credible "good enough, ship it" answer that closes the resilience backlog item without opening a multi-quarter platform program.
  • Use cases: wrapping outbound HTTP/gRPC clients, queue jobs that call flaky partners, webhook delivery, aggregator/feed fetches, and any endpoint where "fail fast with a fallback" beats "wait for a timeout."

When to Consider This Package

Consider adopting when:

  • You run PHP, and especially Laravel, services with a handful of outbound dependencies and no existing resilience layer.
  • The team is small-to-mid and time-constrained — a mature, single-purpose implementation beats bespoke code you'd have to test, document, and own.
  • You want breaker state shared across processes/instances (e.g., cache/Redis-backed storage) rather than per-request memory, so trips are visible to the whole fleet.
  • You need per-dependency or per-endpoint granularity and configurable thresholds, rather than a global "the network is down" switch.
  • You're willing to own the observability layer yourself — emitting metrics/logs on state transitions into whatever you already run (Prometheus, OpenTelemetry, Datadog).
  • You want a low-commitment trial: the pattern is well understood, so backing it out later is cheap.

Look elsewhere — or build — when:

  • You need cross-language or infrastructure-level resilience (service mesh outlier detection, Envoy/Istio retries and ejection, API gateway policies). Application-level breakers in one language won't cover polyglot fleets.
  • You need adaptive/advanced behavior — concurrency limits, load shedding, request hedging, latency-percentile-based tripping (e.g., a Netflix-concurrency-limits-style approach) rather than a fixed failure-rate threshold.
  • Observability integration is a hard requirement with first-class OpenTelemetry traces/metrics out of the box; expect to instrument this yourself.
  • Governance favors first-party or vendor-supported components. A ~300-star community package with a single maintainer is a real, if modest, supply-chain consideration — check release cadence (last release mid-2025 is a positive signal), test coverage, issue responsiveness, and Laravel version support before betting a money path on it.
  • Traffic or criticality is too low to justify it. At low volume, a simple timeout plus retry-with-backoff may be sufficient; breakers add tuning surface and confusing failure modes if nobody owns them.
  • You already have retry/timeout/circuit-breaking in the HTTP client or platform layer and would otherwise duplicate policy in two places.

Adoption checklist: pin the version, wrap it behind a thin internal interface so the implementation is swappable, define thresholds per dependency with the on-call engineer, and agree in advance on the fallback behavior and the alert that fires when a breaker opens.

How to Pitch It (Stakeholders)

For executives (30 seconds): Our product depends on outside services we don't control — payments, shipping, messaging, identity. Today, when one of them slows or fails, our users see timeouts and errors and our engineers spend hours firefighting. A circuit breaker stops us from hammering a service that's already failing and lets the product switch to a defined fallback instead of hanging. This is a small, mature, low-cost open-source library used in the PHP layer — roughly days of engineering effort, no new infrastructure, and no vendor contract. It reduces the blast radius of third-party outages and improves the reliability metrics we report against. It does not replace monitoring or fix slow dependencies; it buys us predictable, graceful degradation.

For engineering leadership: It's a focused implementation of a pattern we already understand, with Laravel integration and pluggable state storage, so breaker state is shared across our instances. Integration is narrow: an interface wrapper, per-dependency configuration, and metric emission on state transitions. The main risks are ownership and observability — one maintainer, and no batteries-included telemetry — both of which we mitigate by wrapping it behind our own abstraction and instrumenting it into the existing stack. Effort is measured in days, and reversal cost is low.

For product and support: When a dependency is unhealthy, users get a defined experience — cached content, a hidden module, or an honest "temporarily unavailable" message — instead of a spinner and a timeout. It also gives support a clear signal ("this breaker is open") to explain an incident accurately and to set expectations on the status page.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource