Download the PHP package uuf6429/rune without Composer
On this page you can find all versions of the php package uuf6429/rune. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor uuf6429
Package rune
Short Description PHP Rule Engine.
License MIT
Homepage https://github.com/uuf6429/rune
Package rune
Short Description PHP Rule Engine.
License MIT
Homepage https://github.com/uuf6429/rune
Please rate this library. Is it a good library?
Informations about the package rune
ᚱᚢᚾᛖ
Rune - A PHP Rule Engine Toolkit.
This library is an implementation of a Business Rule Engine (a type of Business Process Automation software).
Table Of Contents
- ᚱᚢᚾᛖ
- Table Of Contents
- Installation
- Architecture
- Usage
- Live Example
- Example Code
Installation
The recommended and easiest way to install Rune is through Composer:
Architecture
The library is made up of the following main parts:
- Rule (impl.
Rule\RuleInterface
) - object representing a business rule. For most use-cases, one can just useRule\GenericRule
. Each rule must have a unique id, descriptive name, a condition (as an expression that returnstrue
orfalse
) and the action (see below) to be triggered when the condition is met. - Action (impl.
Action\ActionInterface
) - an object that does something when the associated rule is triggered. Actions in general can be reused by multiple rules. For example, if you're using the rule engine in product sales, an action might automatically add a fee to the bill when a certain condition applies (e.g. a fee for specific delivery countries, or a negative fee for a discount). - Context (impl.
Context\ContextInterface
) - an object that provides data to the rule engine and action to work with. This can be thought of as a collection of all the available data for the current situation. For example, when the current situation is about a user buying a product, you would have data about the user, the product, offers, and perhaps also higher level information such as time, locality etc. You almost always have to implement your own context since this always depends on your (business) scenario. - RuleEngine - essentially, the object that connects the others together to function.
Usage
Various examples can be found in uuf6429/rune-examples.
Live Example
Example Code
The following code is a very simple example of how Rune can be used. It defines one model (Product
),
context (ProductContext
) and uses CallbackAction
to print out the rules that have been triggered.
All versions of rune with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.4 || ^8
symfony/expression-language Version ^4 || ^5 || ^6
phpdocumentor/reflection-docblock Version ^5.3
symfony/expression-language Version ^4 || ^5 || ^6
phpdocumentor/reflection-docblock Version ^5.3
The package uuf6429/rune contains the following files
Loading the files please wait ....