1. Go to this page and download the library: Download aegisora/json-rule 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/ */
aegisora / json-rule example snippets
json_decode($value);
if (json_last_error() !== JSON_ERROR_NONE) {
// value is not valid JSON
}
use Aegisora\RuleContract\Models\Context;
use Aegisora\Rules\JsonRule;
$result = JsonRule::create()->validate(Context::create('{"name": "Aegisora"}'));
if ($result->isValid()) {
// value is valid JSON
} else {
// value is not valid JSON
}
use Aegisora\Guardian\Guardian;
use Aegisora\Rules\JsonRule;
use App\Exceptions\InvalidPayloadException;
$guardian = new Guardian();
$guardian
->that($rawPayload)
->must(JsonRule::create(), new InvalidPayloadException())
->validate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.