1. Go to this page and download the library: Download aegisora/numeric-range-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 / numeric-range-rule example snippets
if ($value < $min || $value > $max) {
// value is out of the allowed boundary
}
use Aegisora\RuleContract\Models\Context;
use Aegisora\Rules\NumericRangeRule;
$result = NumericRangeRule::createBetween(1, 100)->validate(Context::create(42));
if ($result->isValid()) {
// value satisfies the boundary
} else {
// value is out of the allowed boundary
}
use Aegisora\Guardian\Guardian;
use Aegisora\Rules\NumericRangeRule;
use App\Exceptions\InvalidAgeException;
$guardian = new Guardian();
$guardian
->that($age)
->must(NumericRangeRule::createBetween(18, 120), new InvalidAgeException())
->validate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.