PHP code example of alexkratky / validatorx

1. Go to this page and download the library: Download alexkratky/validatorx 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/ */

    

alexkratky / validatorx example snippets




use AlexKratky\Validator;
use AlexKratky\IValidator;

Validator::addRule("TestRule", new class implements IValidator {
    public static function validate($input): bool {return ($input === "test");}
});

Validator::customValidate("Alex", "TestRule"); // false
Validator::customValidate("test", "TestRule"); // true
Validator::validate("test", Validator::RULE_CUSTOM, "TestRule"); // true