PHP code example of jlis / judge

1. Go to this page and download the library: Download jlis/judge 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/ */

    

jlis / judge example snippets


'providers' => [
    Jlis\Judge\JudgeServiceProvider::class,
];

'aliases' => [
    'Feature' => Jlis\Judge\Feature::class,
    'Value'   => Jlis\Judge\Value::class,
];

'show_memory_usage' => [
    [
        'value'   => true,
        'filters' => ['debug:true'],
    ],
],

'enable_captcha' => [
    [
        'value'   => true,
    ],
],

'enable_captcha' => [
    [
        'value'   => true,
        'filters' => ['env:production', 'expression_language:user==null'],
    ],
],

'enable_captcha' => [
    [
        'value'   => true,
        'filters' => ['expression_language:user==null'],
    ],
    [
        'value'   => true,
        'filters' => ['env:production'],
    ],
],

'enable_debug_output' => [
    [
        'value'   => true,
        'filters' => ['!env:production'],
    ],
],

'greeting' => [
    [
        'value'   => 'Hello my lady!',
        'filters' => ['expression_language:user.getGender()=="female"'],
    ],
    [
        'value' => 'Hello sir.',
    ],
]

'package_price' => [
    [
        'value'   => 10.00,
    ],
],

'package_price' => [
    [
        'value'   => 00.00,
        'filters' => ['expression_language:user.hasPlan("premium")'],
    ],
    [
        'value'   => 10.00,
    ],
],

'package_price' => [
    [
        'value'   => 5.00,
        'filters' => ['expression_language:user.getRegisterDays() >= 365', 'made_at_least_one_purchase'],
    ],
    [
        'value'   => 10.00,
    ],
],

$greeting = Value::decide('greeting', $this->getUser());
echo $greeting;

if (Feature::decide('show_memory_usage', Auth::user())) {
    echo 'Memory usage: ' . memory_get_usage();
}

php artisan vendor:publish

app/config/features.php

app/config/values.php

app/config/judge.php

app/config/judge.php