linio/rule-engine 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

linio/rule-engine

最新稳定版本:2.0.0

Composer 安装命令:

composer require linio/rule-engine

包简介

Versatile rule engine that allows to apply logic to a given context.

README 文档

README

Latest Stable Version License Build Status Scrutinizer Code Quality

This is a small and versatile rule engine that allows you run conditional logic and predetermined statements on a given context. It has a Parser that targets a very simplistic AST. By default, we have included a Blockly XML parser, but you can add pretty much anything else.

Install

The recommended way to install Linio Rule Engine is through composer.

{
    "require": {
        "linio/rule-engine": "^1.0"
    }
}

Tests

To run the test suite, you need install the dependencies via composer, then run PHPUnit.

$ composer install
$ phpunit

Usage

The RuleEngine interpreter uses a parser to create the AST tree based on a provided string, which is the actual rule source. You can create your own parser or use an existing one, like the BlocklyXmlParser. A context must be an instance of a Dictionary.

<?php

use Linio\Type\Dictionary;
use Linio\Component\RuleEngine\Interpreter;

$context = new Dictionary(['item' => 11]);
$interpreter = new Interpreter();
$interpreter->setParser(...);
$interpreter->evaluate('rule source', $context);

统计信息

  • 总下载量: 4.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 53
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-08-11