All Projects → K-Phoen → RulerZBundle

K-Phoen / RulerZBundle

Licence: MIT license
Symfony Bundle for RulerZ

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to RulerZBundle

Json Rules Engine
A rules engine expressed in JSON
Stars: ✭ 1,159 (+2950%)
Mutual labels:  rules, rule-engine
Rulette
A pragmatic business rule management system
Stars: ✭ 91 (+139.47%)
Mutual labels:  rules, rule-engine
cs-expert-system-shell
C# implementation of an expert system shell
Stars: ✭ 34 (-10.53%)
Mutual labels:  rules, rule-engine
ruledesigner
Rule Designer is the Eclipse-based development environment for ODM developers.
Stars: ✭ 14 (-63.16%)
Mutual labels:  rules, rule-engine
Node Rules
Node-rules is a light weight forward chaining rule engine written in JavaScript.
Stars: ✭ 481 (+1165.79%)
Mutual labels:  rules, rule-engine
rools
A small rule engine for Node.
Stars: ✭ 118 (+210.53%)
Mutual labels:  rules, rule-engine
EngineX
Engine X - 实时AI智能决策引擎、规则引擎、风控引擎、数据流引擎。 通过可视化界面进行规则配置,无需繁琐开发,节约人力,提升效率,实时监控,减少错误率,随时调整; 支持规则集、评分卡、决策树,名单库管理、机器学习模型、三方数据接入、定制化开发等;
Stars: ✭ 369 (+871.05%)
Mutual labels:  rules, rule-engine
Nrules
Rules engine for .NET, based on the Rete matching algorithm, with internal DSL in C#.
Stars: ✭ 1,003 (+2539.47%)
Mutual labels:  rules, rule-engine
powerflows-dmn
Power Flows DMN - Powerful decisions and rules engine
Stars: ✭ 46 (+21.05%)
Mutual labels:  rules, rule-engine
SpBundle
SAML2 SP Symfony Bundle based on LightSAML
Stars: ✭ 62 (+63.16%)
Mutual labels:  symfony-bundle
FkrCssURLRewriteBundle
A small assetic filter for symfony to fix all url paths at css documents to correct urls
Stars: ✭ 33 (-13.16%)
Mutual labels:  symfony-bundle
ContentfulBundle
Symfony Bundle for the Contentful SDK.
Stars: ✭ 29 (-23.68%)
Mutual labels:  symfony-bundle
service-mesh-performance
Standardizing Service Mesh Value Measurement
Stars: ✭ 234 (+515.79%)
Mutual labels:  specifications
SonataFormatterBundle
Symfony SonataFormatterBundle
Stars: ✭ 78 (+105.26%)
Mutual labels:  symfony-bundle
MsalsasVotingBundle
Provides voting/rating management for your Symfony project.
Stars: ✭ 14 (-63.16%)
Mutual labels:  symfony-bundle
daikon
Dynamic detection of likely invariants
Stars: ✭ 157 (+313.16%)
Mutual labels:  specifications
wordpress-bundle
Use Wordpress and Symfony together using a Symfony bundle
Stars: ✭ 30 (-21.05%)
Mutual labels:  symfony-bundle
GoogleTranslateBundle
A Symfony bundle to deals with Google Translate API
Stars: ✭ 44 (+15.79%)
Mutual labels:  symfony-bundle
DynamicParametersBundle
[UNMAINTAINED] Runtime retrieval of parameters from environment variables for Symfony
Stars: ✭ 42 (+10.53%)
Mutual labels:  symfony-bundle
eslint-rules
My custom eslint rules in addition to the ones provided at http://eslint.org/
Stars: ✭ 94 (+147.37%)
Mutual labels:  rules

RulerZBundle Build Status

This bundle integrates RulerZ into Symfony.

Installation

Require the bundle:

composer require 'kphoen/rulerz-bundle'

And declare it into your app/AppKernel.php file:

public function registerBundles()
{
    return array(
        // ...
        new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
    );
}

Usage

This bundle registers a rulerz service which is an instance of RulerZ\RulerZ.

$rulerz = $this->container->get('rulerz');

$rulerz->filter(/* ... */);

See RulerZ's documentation for more information.

Custom operators

Custom operators can be added to RulerZ executors. The bundle provide a way to register new operators directly from the container, you just need to tag a service:

services:
    operator.array.like:
        class: RulerZ\Operator\ArrayExecutor\Like
        tags:
            - { name: rulerz.operator, target: native, operator: like }

In addition to the rulerz.operator tag, two other values are needed:

  • target: the compilation target we want to register the operator for ;
  • operator: the name that will be given to the operator in rules.

Important: Operators registered as classes must implement the __invoke magic method as RulerZ expects custom operators to be defined as callable.

Validators

A rule validator is provided by the bundle. In its simplest form, it will only validate the syntax of a given rule. Unknown variables or operators won't be detected unless you define a whitelist of accepted values.

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;

class TaggingRule
{
    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @RulerZAssert\ValidRule(
     *  allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"},
     *  allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or"}
     * )
     */
    private $rule;
}

Configuration reference

# app/config/config.yml

rulerz:
    cache: "%kernel.cache_dir%/rulerz"
    debug: "%kernel.debug%"

    targets:
        native: false
        doctrine: false
        doctrine_dbal: false
        eloquent: false
        pomm: false
        solarium: false
        elasticsearch: false

The targets section allows you to enable only the compilation targets needed by your application.

Licence

This bundle is under the MIT licence.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].