PHPackages                             millipress/millirules - 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. millipress/millirules

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

millipress/millirules
=====================

A declarative rule engine for PHP that turns complex conditional logic into readable when-then rules. Features a fluent builder API, lazy-loaded context for performance, smart operator inference, and works seamlessly in pure PHP or WordPress.

v0.7.3(3mo ago)111.3k—0%[1 PRs](https://github.com/MilliPress/MilliRules/pulls)2GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Nov 17Pushed 1mo agoCompare

[ Source](https://github.com/MilliPress/MilliRules)[ Packagist](https://packagist.org/packages/millipress/millirules)[ RSS](/packages/millipress-millirules/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (2)

MilliRules
==========

[](#millirules)

A flexible, framework-agnostic rule evaluation engine for PHP 7.4+.

Overview
--------

[](#overview)

MilliRules is a powerful rule engine that allows you to define complex conditional logic using a fluent API. It's designed to be framework-agnostic while providing specialized support for HTTP and WordPress environments.

Features
--------

[](#features)

- **Fluent API**: Build complex rules with an intuitive, chainable syntax
- **Framework Agnostic**: Core engine works with any PHP application
- **Lazy-Loaded Context**: On-demand loading of context data for optimal performance
- **HTTP Support**: Built-in conditions for request handling
- **WordPress Integration**: Native support for WordPress queries and context
- **Extensible**: Easy to add custom conditions and actions
- **Flexible Naming**: Use snake\_case or camelCase — `when_all()` and `whenAll()` both work
- **PHP 7.4+ Compatible**: Works with PHP 7.4+, PHP 8.0+ recommended

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

[](#installation)

```
composer require millipress/millirules
```

Quick Start
-----------

[](#quick-start)

```
use MilliRules\Rules;

// Simple HTTP rule
Rules::create('api_check')
    ->when()
        ->request_url('/api/*')
    ->then()
        ->custom( 'auth-check', function($context) {
            // Your action here
        })
    ->register();
```

Documentation
-------------

[](#documentation)

See the [full documentation](https://millipress.com/docs/millirules/) for detailed guides and API reference.

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 96.4% 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.

###  Release Activity

Cadence

Every ~7 days

Recently: every ~1 days

Total

14

Last Release

92d ago

### Community

Maintainers

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

---

Top Contributors

[![ouun](https://avatars.githubusercontent.com/u/32090713?v=4)](https://github.com/ouun "ouun (132 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

actionsconditionsfluent-apiphpruleswordpress

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/millipress-millirules/health.svg)

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

PHPackages © 2026

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