PHP code example of aegisora / instanceof-rule
1. Go to this page and download the library: Download aegisora/instanceof-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 / instanceof-rule example snippets
$value instanceof ClassName
use Aegisora\Rules\InstanceofRule;
use Aegisora\RuleContract\Models\Context;
class User {}
$result = InstanceofRule::create(User::class)->validate(Context::create(new User()));
if ($result->isValid()) {
// value is instance of User
} else {
// value is not instance of User
}
InstanceofRule::create($className);