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

Ganesha Laravel Package

ackintosh/ganesha

Ganesha is a PHP circuit breaker library that prevents cascading failures by stopping calls to failing services and failing fast. It offers configurable thresholds, fallbacks, and storage adapters for Redis, Memcached, and Laravel, making distributed systems more resilient.

View on GitHub
Deep Wiki
Context7

:elephant: A Circuit Breaker pattern implementation for PHP applications.

Frequently asked questions about Ganesha
How do I install ackintosh/ganesha in a Laravel application?
Install it with Composer via composer require ackintosh/ganesha along with a storage adapter for the backend you plan to use, such as the Redis or Memcached adapter. Ganesha is framework-agnostic, so it will not auto-register in Laravel; you add a thin service provider, a namespaced config file, and a facade or ResilientClient wrapper. The spike itself is a same-day task, and the real work is deciding thresholds, failure classification, and fallback behavior per dependency.
Does Ganesha support Laravel 10, 11 and 12?
Ganesha does not depend on Laravel internals, so it works across Laravel 10 through 12 as long as your PHP version and the underlying Redis or Memcached extensions satisfy the library's constraints. Because it is framework-agnostic, Laravel upgrades are unlikely to break your breaker integration. Verify PHP and ext-redis or ext-memcached compatibility against your runtime before you commit.
How do I configure Ganesha's failure thresholds, window, and cooldown?
Ganesha supports pluggable failure strategies, including count-based and rate-based thresholds, plus a cooldown period before the circuit moves to half-open and allows a probe request. A typical starting policy is tripping after five failures within sixty seconds with a thirty-second cooldown, tuned per downstream dependency. Keep these values in a namespaced config file and assign an explicit owner so thresholds do not drift between teams.
Which storage adapters does Ganesha support for breaker state?
Ganesha ships adapters for Redis, Predis, Memcached, and MongoDB, so breaker state can live in shared infrastructure rather than in process memory. The native Redis adapter on a dedicated connection is usually the better choice than a custom adapter over Laravel's cache contract, because the cache abstraction hides breaker semantics. External state is also what makes the library compatible with Octane, Swoole, and multi-node deployments.
Do I need a service provider or facade to use Ganesha with Laravel?
There is no official Laravel bridge, so you own a thin service provider, a config file, and a facade or wrapper class around the breaker. That is a modest amount of glue in exchange for portability and a small, auditable API surface. Expect one to two sprints if you include observability hooks, shadow-mode calibration, and a game day alongside the wrapper.
Should 4xx responses count as failures in Ganesha?
Generally no. Timeouts and 5xx responses should count as failures, while 4xx client errors usually reflect the caller's request and would open circuits during normal traffic if counted. Ganesha lets you decide which exceptions or results are treated as failures, so encode that policy explicitly per dependency. Misclassified errors opening circuits is one of the most common production mistakes with circuit breakers.
What happens when Redis is unavailable: does Ganesha fail open or fail closed?
The state store, not the library, is the primary technical risk: if Redis is unavailable, breaker reads and writes fail and you must decide the behavior yourself. Fail-open protects availability but risks cascading failures, while fail-closed protects the downstream service but degrades the user experience. Document that decision per dependency along with the Redis SLA and latency budget.
Can Ganesha wrap Laravel's HTTP client or Guzzle middleware?
Yes. Ganesha composes well with Guzzle middleware and Laravel's HTTP client, and it can also wrap queue job dispatch or consumption. Be explicit about layering order, since retries and breakers interact; a common approach is the breaker outside the retry loop so repeated retries do not each count as separate failures. Ganesha does not replace retries, timeouts, or bulkheads, so treat it as one layer in a documented resilience stack.
How do I test a circuit breaker built with Ganesha?
Unit test the policies rather than the network: assert that the configured threshold trips the circuit, that requests fail fast while open, and that the half-open probe closes it again after the cooldown. Use an in-memory or test-specific storage adapter so tests do not depend on Redis. Also run a shadow mode on one non-critical dependency, recording would-be trips without enforcing, before you enable enforcement on a critical path.
Is ackintosh/ganesha production-ready and actively maintained?
The library is MIT licensed with a small, stable API, roughly 670 GitHub stars, and a single maintainer, so treat it as a utility rather than a platform bet. Production readiness depends more on your policy decisions, such as failure classification, fallback contract, and alerting on state transitions, than on the code itself. Lock-in and exit costs are low, so vendoring a fork or building a small wrapper is a reasonable hedge if maintenance stalls.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource