PHPackages                             vestin/logic-checker - 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. vestin/logic-checker

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

vestin/logic-checker
====================

复杂逻辑检查器

1.0(9y ago)0517MITPHP

Since May 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Vestin/logic-checker)[ Packagist](https://packagist.org/packages/vestin/logic-checker)[ RSS](/packages/vestin-logic-checker/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

logic-checker
-------------

[](#logic-checker)

a reusable,SRP component for complex logic checker.

- write DRY code
- preventing to use lots of if else statement
- make logic checker reusable

[![Build Status](https://camo.githubusercontent.com/b8af0ff42f7523aa1d29c391c8590e2c9cd14600d08bb6d5c76e7917f60690c7/68747470733a2f2f7472617669732d63692e6f72672f56657374696e2f6c6f6769632d636865636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Vestin/logic-checker)

### usage:

[](#usage)

install

```
composer require "vestin/logic-checker:*",

```

### example:

[](#example)

write a checker

```
use Vestin\Checker\CheckNotPassException;

class MathAddChecker implements CheckerInterface
{

    private $paramOne;
    private $paramTwo;
    private $result;

    public function __construct($paramOne, $paramTwo, $result)
    {
        $this->paramOne = $paramOne;
        $this->paramTwo = $paramTwo;
        $this->result = $result;
    }

    public function check() {
        if( ($this->paramOne + $this->paramTwo) != $this->result){
            throw new CheckNotPassException('calc error');
        }
    }

}

```

check passed example:

```
include 'vendor/autolad.php'

$dispatcher = new \Vestin\Checker\Dispatchers\SimpleDispatcher();
$checkerBus = new \Vestin\Checker\CheckerBus($dispatcher);

$checker = new MathAddChecker(1, 2, 3); // 1+2=3
$checker2 = new MathAddChecker(2, 3, 5); // 2+3=5

$checkerBus->addChecker($checker)
           ->addChecker($cherker2);

if($checkerBus->check()){
    // check pass
    echo 'check passed'; // this will called
}else{
    // check not pass
    $error = $checkerBus->getError();
}

```

check not passed example:

```
include 'vendor/autolad.php'

$dispatcher = new \Vestin\Checker\Dispatchers\SimpleDispatcher();
$checkerBus = new \Vestin\Checker\CheckerBus($dispatcher);

$checker = new MathAddChecker(1, 2, 3); // 1+2=3
$checker2 = new MathAddChecker(2, 3, 6); // 2+3=5 this is wrong

$checkerBus->addChecker($checker)
           ->addChecker($cherker2);

if($checkerBus->check()){
    // check pass
    // echo 'check passed';
}else{
    // check not pass
    // this will called
    $error = $checkerBus->getError(); // $error will be a string 'calc error';
}

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity63

Established project with proven stability

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc645423526b4d789381df1b6052ba2043b3b7960c94ae1166cf2763415ec497?d=identicon)[Vestin](/maintainers/Vestin)

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/vestin-logic-checker/health.svg)

```
[![Health](https://phpackages.com/badges/vestin-logic-checker/health.svg)](https://phpackages.com/packages/vestin-logic-checker)
```

PHPackages © 2026

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