Ruler is an open-source PHP production rules engine that evaluates configurable business conditions and executes corresponding actions. Its stateless architecture separates rule definitions from the data used during evaluation. The library provides a straightforward domain-specific language for constructing rules with readable comparison and logical operations. Developers can define conditions involving numbers, strings, booleans, collections, and mathematical expressions. It supports arithmetic calculations, set operations, and combinations of multiple propositions within a single rule. A context object supplies values or callable expressions when rules are evaluated. Actions can be attached to rules and executed when their conditions are satisfied. Ruler does not prescribe how rules are stored or managed, allowing integration with databases, configuration files, and custom application frameworks.
Features
- Stateless Business Rule Evaluation
- Fluent RuleBuilder Domain-Specific Language
- Logical and Comparison Operators
- Mathematical and Set-Based Operations
- Dynamic Context Variables and Callable Values
- Conditional Action Execution