A flexible, framework-agnostic rule evaluation engine for PHP 7.4+.
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.
- 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
composer require millipress/millirulesuse MilliRules\Rules;
// Simple HTTP rule
Rules::create('api_check')
->when()
->request_url('/api/*')
->then()
->custom( 'auth-check', function($context) {
// Your action here
})
->register();See the full documentation for detailed guides and API reference.
GPL-2.0-or-later