Skip to content

o-p/json-logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f9f97db · Sep 28, 2020

History

10 Commits
Sep 22, 2020
Sep 28, 2020
Sep 28, 2020
Sep 22, 2020
Sep 18, 2020
Sep 18, 2020
Sep 22, 2020
Sep 22, 2020
Sep 16, 2020
Sep 18, 2020
Sep 22, 2020

Repository files navigation

An unofficial PHP implementation of JsonLogic

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);
        })
    );