PHP code example of aegisora / emptiness-rule
1. Go to this page and download the library: Download aegisora/emptiness-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 / emptiness-rule example snippets
use Aegisora\Rules\Emptiness\NotEmptyRule;
use Aegisora\RuleContract\Models\Context;
$result = NotEmptyRule::create()->validate(Context::create('hello'));
if ($result->isValid()) {
// value is NOT empty
} else {
// value is empty
}
use Aegisora\Rules\Emptiness\EmptyRule;
use Aegisora\RuleContract\Models\Context;
$result = EmptyRule::create()->validate(Context::create([]));
if ($result->isValid()) {
// value is empty
} else {
// value is NOT empty
}
EmptyRule::create();
NotEmptyRule::create();