Circuit breaker implementation in php as shown at http://en.wikipedia.org/wiki/Circuit_breaker_design_pattern