PHP code example of olivierpicault / json-evaluator-php

1. Go to this page and download the library: Download olivierpicault/json-evaluator-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

olivierpicault / json-evaluator-php example snippets


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

composer