o-p/json-logic

Make it easier to process large amount data with JsonLogic

v0.0.2 2020-09-28 07:44 UTC

This package is auto-updated.

Last update: 2024-03-28 15:36:29 UTC


README

Usage

  • For an one-time logic to data use case, the apply function is enough:

    echo \JsonLogic\JsonLogic::apply($rule, $data);
  • For a rule runs tons times, e.g. find matched records in daily logs:

    $rule = \JsonLogic\JsonLogic::rule($rule);
    
    var_dump(
        array_filter($logs, function ($log) use ($rule) {
            return $rule->process($log);
        })
    );