PHPackages                             damianopetrungaro/circuit-breaker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. damianopetrungaro/circuit-breaker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

damianopetrungaro/circuit-breaker
=================================

A Circuit breaker written in PHP

v1.0.1(6y ago)15MITPHP

Since Aug 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/damianopetrungaro/circuit-breaker)[ Packagist](https://packagist.org/packages/damianopetrungaro/circuit-breaker)[ RSS](/packages/damianopetrungaro-circuit-breaker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

Circuit breaker
===============

[](#circuit-breaker)

This is a [circuit breaker](https://en.wikipedia.org/wiki/Circuit_breaker) implementation for PHP applications.

The library is tested with integration and functional tests in order to make you feel more comfortable about it.

Later unit tests will be added too.

Installation
============

[](#installation)

`php composer.phar require damianopetrungaro/circuit-breaker`

How does it work?
-----------------

[](#how-does-it-work)

This circuit breaker implementation wrap the function that you want to execute inside a callable (a function or an invokable object).

The function is then passed across the different middleware stages that an be used.

It's really easy to add your own custom middleware (such as a delay or even logging). Take a look to the Retry middleware as an example.

Example
-------

[](#example)

This is a basic example using an in memory adapter with a retry middleware.

```
