Navigation Menu

Skip to content

K-Phoen/rulerz-spec-builder

Repository files navigation

RulerZ Specification builder Build Status

This library provides an object-oriented way to build Specifications for RulerZ.

Installation

composer require 'kphoen/rulerz-spec-builder'

Usage

$spec = Expr::andX(
    Expr::equals('gender', 'F'),
    Expr::moreThan('points', 3000)
);

This is equivalent to gender = "F" and points > 3000

Here is a more complex example:

$spec = Expr::orX(
    Expr::andX(
        Expr::equals('gender', 'F'),
        Expr::moreThan('points', 3000)
    ),
    Expr::andX(
        Expr::equals('gender', 'M'),
        Expr::moreThan('points', 6000)
    )
);

Which is equivalent to: (gender = "F" and points > 3000) or (gender = "M" and points > 6000)

See the Expr class for an exhaustive list of supported methods.

License

This library is under the MIT license.

About

Specification builder for RulerZ

Resources

License

Stars

Watchers

Forks

Packages

No packages published