alexkratky/validatorx

Class to validate the user inputs.

v1.0.0 2020-05-14 09:17 UTC

This package is auto-updated.

Last update: 2024-11-14 19:06:29 UTC


README

Class to validate the user inputs.

Installation

composer require alexkratky/validatorx

Usage

require 'vendor/autoload.php';

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