定制 decisionrules/decisionrules-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

decisionrules/decisionrules-php

Composer 安装命令:

composer require decisionrules/decisionrules-php

包简介

Simple library for connecting your app to your DecisionRules.io

README 文档

README

Decisionrules.io library that allows you to integrate DecisionRules Solver and Management API to you application as easily as possible. SDK allow you to solve all rule types that are available, CRUD operations on all rule types, rules status management and rule tags management.

VERSION 3 IS NEW MAJOR VERSION OF THIS SDK AND IT IS STRONGLY RECOMMENDED, DUE TO DEPRECATION OF OLDER VERSIONS.

Installation

You can simply integrate SDK to your project via NPM package manager.

Defining Custom domain

Custom domain is special class that is designed for those who uses DecisionRules in private cloud or as on-premise. Class takes up to 3 arguments.

Domain argument is name of desired domain, protocol is HTTP or HTTPS and port is TCP/IP port.

If port is not defined in the class constructor it is set to default value by protocol value, 80 for HTTP and 443 for HTTPS.

$customDomain = new  CustomDomain("localhost", Protocols::HTTP, 8080);

Using Solver API

Solver class takes up to 2 arguments that are api key(can be generated on dashboard), custom domain object. Class exposes two methods: solveRule and solveRuleFlow.

use DecisionRules\Solver;
use DecisionRules\Enums\SolverStrategy;

public function awesomeSolver(){
	$ruleId = "MY_RULE_ID";
	$solver = new Solver($apiKey);
	$request = (object) array('data'=> array('input_attribute'=> 'value'));
	return $solver->solveRule($ruleId, $request, SolverStrategy::STANDARD);
}

Using Management API

Management class takes on argument, management api key. Class exposes number of methods listed below.

  • getRule - get rule by itemId and version*

  • createRule - create rule by spaceId and ruleData

  • updateRule - updates rule by itemId, newRuleData and version*

  • deleteRule - deletes rule by itemId and version

  • getSpaceItems - get space items that belongs to management api key

  • getRuleFlow - get rule by itemId and version*

  • createRuleFlow - create ruleflow in space that belongs to management api key

  • updateRuleFlow - updates ruleflowby itemId, newRuleflowData and version*

  • deleteRuleFlow - deletes ruleflow by itemId and version

  • exportRuleFlow - exports ruleflow by itemId and version*

  • importRuleFlow - import ruleflow as a new ruleflow or new version of existing ruleflow or override existing ruleflow.

  • changeRuleStatus - changes rule status

  • changeRuleFlowStatus - changes ruleflow status

  • getRulesByTags - gets rule by tag.

  • updateTags - update tags on rule or ruleflow

  • deleteTags - delete tags on rule or ruleflow

* = optional argument

Example usage

use DecisionRules\Management;

public  manageRules(){
	$managementKey = "MY_MANAGEMENT_KEY";
	$manager = new Management($managementKey);
	return $manager->getRule($ruleId, 1);
}

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固