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.
Install / Use
/learn @MilliPress/MilliRulesREADME
MilliRules
A flexible, framework-agnostic rule evaluation engine for PHP 7.4+.
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
- 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()andwhenAll()both work - PHP 7.4+ Compatible: Works with PHP 7.4+, PHP 8.0+ recommended
Installation
composer require millipress/millirules
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
See the full documentation for detailed guides and API reference.
License
GPL-2.0-or-later
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
