kphoen / rulerz-spec-builder
Specification builder for RulerZ
Installs: 42 917
Dependents: 0
Suggesters: 5
Security: 0
Stars: 11
Watchers: 4
Forks: 4
Open Issues: 0
Requires
- php: >=7.0
- kphoen/rulerz: ~0.17,>=0.19.3
Requires (Dev)
- liip/rmt: ^1.2
- phpspec/phpspec: ~2.2
This package is auto-updated.
Last update: 2024-10-28 02:14:50 UTC
README
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.