olivierpicault/json-evaluator-php

There is no license information available for the latest version (1.0.3) of this package.

A package to evaluate a json structure

1.0.3 2019-07-09 09:59 UTC

This package is auto-updated.

Last update: 2025-06-09 23:31:15 UTC


README

The PHP version of json-evaluator.

Installation

composer require olivierpicault/json-evaluator-php

Basic usage

use JsonEvaluator\Evaluate;

// Basic instance
$instance = [
    'compare'   => [
        'type'  => 'string',
        'value' => 'olivier',
    ],
    'compareTo' => [
        'type'  => 'string',
        'value' => 'stéphane',
    ],
    'operator'  => '=='
];

// Instance is expected to be type of stdClass
$instance = json_decode(json_encode($instance, 0));

// Fields is expected to be type of array
$fields = [];

$evaluator = new Evaluate();
$evaluator->evaluate($instance, $fields); // false

Tests

composer test