PHPackages                             villaflor/decree - 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. villaflor/decree

ActiveLibrary

villaflor/decree
================

Rule Engine

1.0.0(3y ago)04[2 PRs](https://github.com/villaflor/decree/pulls)MITPHPPHP ^8.0|^8.1

Since Dec 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/villaflor/decree)[ Packagist](https://packagist.org/packages/villaflor/decree)[ Docs](https://github.com/villaflor/decree)[ GitHub Sponsors](https://github.com/villaflor)[ RSS](/packages/villaflor-decree/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

Let's Automate
==============

[](#lets-automate)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/85cc1aca5cc01a4711e045d6384977a66e445fcf6b272ef4658144a42ecbf321/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76696c6c61666c6f722f6465637265652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/villaflor/decree)[![PHP Version Supported](https://camo.githubusercontent.com/3ed6787ce6b69b97ffa784cd6a01789a223bf63546fbe0ee33580eabf00fdcf7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f76696c6c61666c6f722f6465637265653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/villaflor/decree)[![License](https://camo.githubusercontent.com/31119070d5046700648ed2ce82e9e106b935ae2b87d32515e192ac957c3ae5a6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f76696c6c61666c6f722f6465637265652e7376673f7374796c653d666c61742d737175617265)](https://github.com/villaflor/decree/blob/main/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/6d53abec4b02446187f947afdcdf8117b8149dc0afdc056ace758a36bcce6983/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76696c6c61666c6f722f6465637265652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/villaflor/decree)[![Tests](https://github.com/villaflor/decree/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/villaflor/decree/actions/workflows/run-tests.yml)

Chain Command.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require villaflor/decree
```

Usage
-----

[](#usage)

```
$data = [
    'roi' => 1
];

// action list
$noAction = new NoAction();
$terminalLog = new TerminalLog();

//rule list
$isRoiGreaterThan1 = new GreaterThan($data['roi'], 1);
$isRoiLessThan1 = new LessThan($data['roi'], 1);
$isRoiEquals1 = new Equals($data['roi'], 1);
$isRoiEquals1Strict = new Equals($data['roi'], 1, true);

$secondNode = new Node([
    [
        'rule' => $isRoiEquals1,
        'next' => $noAction,
    ],
    [
        'rule' => $isRoiEquals1,
        'next' => $terminalLog,
    ],
]);
$firstNode = new Node([
    [
        'rule' =>$isRoiEquals1Strict,
        'next' => $secondNode,
    ],
    [
        'rule' => $isRoiGreaterThan1,
        'next' => $terminalLog,
    ],
    [
        'rule' => $isRoiLessThan1,
        'next' => $terminalLog,
    ]
]);

$x = $firstNode->handle($data);

var_dump($x);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mark Anthony Villaflor](https://github.com/villaflor)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

1232d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60b659450734f21a7a920500011a61a9996cb5112cf18a05bf8131916167e50a?d=identicon)[villaflor](/maintainers/villaflor)

---

Top Contributors

[![villaflor](https://avatars.githubusercontent.com/u/15763160?v=4)](https://github.com/villaflor "villaflor (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

villaflordecree

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/villaflor-decree/health.svg)

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

PHPackages © 2026

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