PHPackages                             pyjac/opinmona - 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. pyjac/opinmona

ActiveLibrary

pyjac/opinmona
==============

00PHPCI failing

Since Apr 25Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Opinmona
--------

[](#opinmona)

Opinmona is an implementation of [Circuit Breaker](https://martinfowler.com/bliki/CircuitBreaker.html) in PHP.

### Usage

[](#usage)

Opinmona serves as a wrapper around methods or any callable you want to circuit break.

#### Usage for object method

[](#usage-for-object-method)

```
use Pyjac\Opinmona\CircuitBreakerFactory;
use Pyjac\Opinmona\CircuitBreakerOpenException;

class TestApi {
    public function send(string $a) {
        return $a;
    }
}

$api = new TestApi();
$cb = CircuitBreakerFactory::fromMethod($api, 'send');
try {
    $cb->invoke(2);
} catch(CircuitBreakerOpenException $e) {
    //
}
```

#### Usage for callable class

[](#usage-for-callable-class)

```
use Pyjac\Opinmona\CircuitBreakerFactory;
use Pyjac\Opinmona\CircuitBreakerOpenException;

class TestApiCallable {
    public function __invoke(string $a)
    {
        return $a;
    }
}

$api = new TestApiCallable();

$cb = CircuitBreakerFactory::fromCallable($api);

try {
    $cb->invoke(2);
} catch(CircuitBreakerOpenException $e) {
    //
}
```

#### Usage for function

[](#usage-for-function)

```
use Pyjac\Opinmona\CircuitBreakerFactory;
use Pyjac\Opinmona\CircuitBreakerOpenException;

$testApiFunction = function (string $a) {
    return $a;
};

$cb = CircuitBreakerFactory::fromCallable($testApiFunction);

try {
    $cb->invoke('something');
} catch(CircuitBreakerOpenException $e) {
    //
}
```

### Updating options and Storage

[](#updating-options-and-storage)

```
use Pyjac\Opinmona\CircuitBreakerFactory;
use Pyjac\Opinmona\CircuitBreakerOpenException;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

class TestApiCallable {
    public function __invoke(string $a)
    {
        return $a;
    }
}

$options = [
    'ttl' => 5600,
    'cachePrefix' => 'my-key',
    'maxFailures' => 10,
    'retryTimeoutInSeconds' => 2,
];

// Error Check function
$errorCheck = function($response, $circuitObject)  {
    return false;
};

$api = new TestApiCallable();
$cb = CircuitBreakerFactory::fromCallable($api, $errorCheck, new ArrayAdapter(), $options);
try {
    $cb->invoke(5)
} catch(CircuitBreakerOpenException $e) {

};
```

### Default Options

[](#default-options)

ValueDescriptionDefaultttlTime-to-live for circuit state cache value3600cachePrefixCache Prefix''maxFailuresMax Failures3retryTimeoutInSecondsretry Timeout In Seconds1

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a099d5df93214acf3c8455392d1c9a5490a5e0a73aec33985a5664f152bb373?d=identicon)[andela-joyebanji](/maintainers/andela-joyebanji)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![pyjac](https://avatars.githubusercontent.com/u/2883868?v=4)](https://github.com/pyjac "pyjac (1 commits)")

---

Tags

breakercircuitcircuit-breakerlibraryphprate-limiterratelimit

### Embed Badge

![Health badge](/badges/pyjac-opinmona/health.svg)

```
[![Health](https://phpackages.com/badges/pyjac-opinmona/health.svg)](https://phpackages.com/packages/pyjac-opinmona)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
