A production-ready Circuit Breaker pattern implementation for PHP applications with multiple strategies and storage adapters.
Ganesha is a Circuit Breaker pattern implementation for PHP applications that helps prevent cascading failures in distributed systems. It monitors external service calls and automatically opens the circuit when failures exceed configured thresholds, allowing systems to fail gracefully and recover. The library provides multiple strategies, storage adapters, and easy integration with popular HTTP clients.
PHP developers building resilient microservices or applications that depend on external APIs and services where failures could cascade and cause system-wide outages.
Developers choose Ganesha because it's a production-ready, well-tested, and actively maintained PHP circuit breaker with simple interfaces, multiple storage backends, and seamless integration with Guzzle and Symfony HttpClient without requiring major code changes.
:elephant: A Circuit Breaker pattern implementation for PHP applications.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports both rate-based and count-based circuit breaking strategies, allowing fine-grained control over failure detection as per Martin Fowler's pattern, detailed in the Strategies section.
Integrates with Redis, Memcached, APCu, and MongoDB, enabling seamless adoption into diverse infrastructure setups without vendor lock-in.
Provides ready-to-use middleware for Guzzle and Symfony HttpClient, making it easy to add circuit breaking to existing API calls with minimal code changes, as shown in the integration examples.
Allows subscription to circuit state changes (e.g., tripped, calmed down) for real-time alerts and logging, enhancing operational visibility without additional tools.
Different adapters implement either sliding or tumbling time windows (e.g., Redis uses sliding, APCu uses tumbling), which can lead to inconsistent failure rate calculations and require careful configuration.
Each storage adapter needs specific PHP extensions or client libraries (e.g., APCu, phpredis), adding deployment complexity and potential compatibility issues in constrained environments.
Lacks a graphical interface for monitoring circuit states; teams must implement custom dashboards using event subscriptions, increasing development overhead for operational insights.