PHPackages                             linio/rule-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. linio/rule-engine

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

linio/rule-engine
=================

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

2.0.0(3y ago)64.0k1BSD-3-ClausePHPPHP ^8.1

Since Aug 11Pushed 2y ago53 watchersCompare

[ Source](https://github.com/LinioIT/rule-engine)[ Packagist](https://packagist.org/packages/linio/rule-engine)[ RSS](/packages/linio-rule-engine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (13)Used By (0)

Linio Rule Engine
=================

[](#linio-rule-engine)

[![Latest Stable Version](https://camo.githubusercontent.com/927dce4b4762da3a8cc538f61271446c963036796e3dd4d8af275d8f8a3ff88d/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f72756c652d656e67696e652f762f737461626c652e737667)](https://packagist.org/packages/linio/rule-engine) [![License](https://camo.githubusercontent.com/5bd22893809c42e4efadf19e7b93edbc56849ac5602bf440b9959745c713180a/68747470733a2f2f706f7365722e707567782e6f72672f6c696e696f2f72756c652d656e67696e652f6c6963656e73652e737667)](https://packagist.org/packages/linio/rule-engine) [![Build Status](https://camo.githubusercontent.com/7f91054ae273169143208ac26f366f656f4eb081a05f04d33d06c040f818414a/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4c696e696f49542f72756c652d656e67696e652e706e67)](http://travis-ci.org/LinioIT/rule-engine) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/3711153fe941a8e823debd796d2755d19d51768ed759369574323511b4622697/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4c696e696f49542f72756c652d656e67696e652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/LinioIT/rule-engine/?branch=master)

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](https://developers.google.com/blockly/) XML parser, but you can add pretty much anything else.

Install
-------

[](#install)

The recommended way to install Linio Rule Engine is [through composer](http://getcomposer.org).

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

Tests
-----

[](#tests)

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

```
$ composer install
$ phpunit

```

Usage
-----

[](#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`.

```
