1. Go to this page and download the library: Download aegisora/string-length-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 / string-length-rule example snippets
$length = mb_strlen($value);
if ($length < $min || $length > $max) {
// length is out of the allowed boundary
}
use Aegisora\RuleContract\Models\Context;
use Aegisora\Rules\StringLengthRule;
$result = StringLengthRule::createGreaterThanOrEqualTo(8)->validate(Context::create('super-secret'));
if ($result->isValid()) {
// length satisfies the boundary
} else {
// length is out of the allowed boundary
}
use Aegisora\Guardian\Guardian;
use Aegisora\Rules\StringLengthRule;
use App\Exceptions\InvalidUsernameException;
$guardian = new Guardian();
$guardian
->that($username)
->must(StringLengthRule::createBetween(3, 32), new InvalidUsernameException())
->validate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.