PHPackages                             pengboomouch/regulus-php - 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. pengboomouch/regulus-php

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

pengboomouch/regulus-php
========================

Small rule library.

50PHP

Since Mar 22Pushed 3y ago2 watchersCompare

[ Source](https://github.com/pengboomouch/regulus-php)[ Packagist](https://packagist.org/packages/pengboomouch/regulus-php)[ RSS](/packages/pengboomouch-regulus-php/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

regulus-php · [![GitHub Actions](https://github.com/pengboomouch/regulus-php/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/pengboomouch/regulus-php/actions/workflows/php.yml/badge.svg?event=push) [![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/pengboomouch/regulus-php/LICENSE)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#regulus-php---)

Regulus Php Version - Lightweight rule organization.

### Install

[](#install)

```
composer require pengboomouch/regulus-php

```

- [Example](#example)
    - [Resolve a specific rule](#resolve-a-specific-rule)
    - [Resolve all rule](#resolve-all-rules)
    - [Resolve a group](#resolve-specific-group)
- [Create conditions](#create-conditions)
- [Create rules](#create-rules)
- [Logs](#logs)

### Example

[](#example)

```
// Define some rules and conditions
$disableRow = new \DisableRowRule(
    new SomeRowCondition(),
    new SomeSecurityCondition()
);

// Init a group and add all rules to it
$regulus = new \Regulus\Regulus();
$regulus->createGroup('row_rules');
$regulus->addRuleTo('row_rules', $disableRow);
```

#### Resolve all rules

[](#resolve-all-rules)

```
$finalResult = $regulus->resolveAll();

if ($finalResult->isFulfilled()) {
    // Do something final
    // ...
} else {
    $failedRules = $finalResult->getFailedRules();
    $failedConditions = $failedRules->getFailedConditions();

    // Log or do something else
}
```

#### Resolve a specific rule

[](#resolve-a-specific-rule)

```
$disableRowResult = $regulus->resolveRuleIn('row_rules', DisableRowRule::class);
if ($disableRowResult->isFulfilled()) {
    // Disable the row
    // ...
}
```

#### Resolve specific group

[](#resolve-specific-group)

```
$rowRuleGroupResult = $resolver->resolveGroup('row_rules');
if ($rowRuleGroupResult->isFulfilled()) {
    // Do something to the rows
    // ...
}
```

### Create conditions

[](#create-conditions)

Define acceptance conditions to be fulfilled.

```
class MyCondition implements \Regulus\Interface\Condition
{
    // Inject all repositories or services you need
    public function __construct(private SomeService $someService)
    {}

    public function isFulfilled(): bool
    {
        // Determine if the condition is fulfilled
        // ...

        return true;
    }
}
```

### Create rules

[](#create-rules)

A rule can have multiple conditions. You can decide for yourself when to return a fail or success result.

```
class MyRule extends \Regulus\Core\AbstractRule
{
    // Inject all needed conditions for this rule
    public function __construct(private MyCondition $someRowCondition)
    {}

    public function resolve(): RuleResult
    {
        $succeededConditions = [];
        $failedConditions = [];

        // Determine if the result is fulfilled
        if(!$this->someRowCondition->isFulfilled()) {
            $isFulfilled = false;
            $failedConditions[] = $this->someRowCondition;
        } else {
            $isFulfilled = true;
            $succeededConditions[] = $this->someRowCondition;
        }

        return $this->createResult(
            $isFulfilled,
            self,
            $succeededConditions,
            $failedConditions
        );
    }
}
```

### Logs

[](#logs)

You can track all conditions for debugging.

```
    $allConditions = $disableRowResult->getAllConditions();

    $fulfilledConditions = $disableRowResult->getFulfilledConditions();

    $failedConditions = $disableRowResult->getFailedConditions();
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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/84a99bd6903d73f1c12b5ef19c0fd0f67d60e45bc4dce2c11bf3bf3061de5f1d?d=identicon)[pengboomouch](/maintainers/pengboomouch)

---

Top Contributors

[![cris-the-creator](https://avatars.githubusercontent.com/u/5107947?v=4)](https://github.com/cris-the-creator "cris-the-creator (1 commits)")

### Embed Badge

![Health badge](/badges/pengboomouch-regulus-php/health.svg)

```
[![Health](https://phpackages.com/badges/pengboomouch-regulus-php/health.svg)](https://phpackages.com/packages/pengboomouch-regulus-php)
```

###  Alternatives

[akaunting/laravel-apexcharts

ApexCharts package for Laravel

84333.7k3](/packages/akaunting-laravel-apexcharts)[ymlluo/group-robot

钉钉、企业微信、飞书 自定义群组机器人。支持链式语法创建发送消息。支持文本、Markdown、图片、文件、图文、卡片等消息。

264.9k1](/packages/ymlluo-group-robot)

PHPackages © 2026

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