maniaba/rule-engine
Composer 安装命令:
composer require maniaba/rule-engine
包简介
A flexible and extensible framework for defining and evaluating rules and conditions, and executing corresponding actions based on specified conditions
关键字:
README 文档
README
The Rule Engine is a flexible and extensible framework for defining and evaluating rules and conditions, and executing corresponding actions based on specified conditions.
Requirements
- PHP 8.1 or higher
- Composer
Installation
Install the package via Composer:
composer require maniaba/rule-engine
For detailed installation instructions and verification, see the Installation Documentation.
Key Features
- Define rules using a structured array configuration
- Combine multiple conditions with logical operators (AND, OR)
- Execute actions based on condition results
- Extend with custom conditions and actions
- Validate rule configurations
Quick Example
<?php use Maniaba\RuleEngine\Builders\ArrayBuilder; use Maniaba\RuleEngine\Context\ArrayContext; // Create a builder $builder = new ArrayBuilder(); // Register an action $builder->actions()->registerAction('printMessage', function(ArrayContext $context, string $message) { echo "Message: {$message}\n"; return true; }); // Define a simple rule $config = [ 'node' => 'condition', 'if' => [ 'node' => 'context', 'contextName' => 'value', 'operator' => 'greaterThan', 'value' => 10, ], 'then' => [ 'node' => 'action', 'actionName' => 'printMessage', 'arguments' => [ 'message' => 'Value is greater than 10', ], ], ]; // Build and execute the rule $ruleSet = $builder->build($config); $context = new ArrayContext(['value' => 15]); $evaluator = new Maniaba\RuleEngine\Evaluators\BasicEvaluator(); $evaluator->execute(clone $ruleSet, $context);
Documentation
Comprehensive documentation is available at https://maniaba.github.io/rule-engine/, including:
- Detailed Configuration Guide
- Advanced Usage Examples
- Custom Conditions and Actions
- Validation and Error Handling
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the rule engine? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.
Testing
composer test
Changelog
All notable changes to this project are documented in the CHANGELOG.md file.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Security
If you discover a security vulnerability, please send an email to maniaba@outlook.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
maniaba/rule-engine 适用场景与选型建议
maniaba/rule-engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.06k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「workflow」 「rules」 「actions」 「conditions」 「rule-engine」 「business-rules」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 maniaba/rule-engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maniaba/rule-engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 maniaba/rule-engine 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.
Magento 2 module which adds support for Speculation Rules API for instant page loads.
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
Business rules engine tools.
Workflow logger
统计信息
- 总下载量: 5.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04