https://github.com/k-phoen/rulerz-spec-builder
Specification builder for RulerZ
https://github.com/k-phoen/rulerz-spec-builder
Last synced: about 1 month ago
JSON representation
Specification builder for RulerZ
- Host: GitHub
- URL: https://github.com/k-phoen/rulerz-spec-builder
- Owner: K-Phoen
- License: mit
- Created: 2015-08-15T23:19:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-17T14:32:19.000Z (about 7 years ago)
- Last Synced: 2025-07-19T15:54:47.992Z (3 months ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
RulerZ Specification builder [](https://travis-ci.org/K-Phoen/rulerz-spec-builder)
============================This library provides an object-oriented way to build Specifications for [RulerZ](https://github.com/K-Phoen/rulerz).
Installation
------------```
composer require 'kphoen/rulerz-spec-builder'
```Usage
-----```php
$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:
```php
$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](https://github.com/K-Phoen/rulerz-spec-builder/blob/master/src/Spec/Expr.php)
class for an exhaustive list of supported methods.License
-------This library is under the [MIT](LICENSE) license.