alexkratky/validatorx

Class to validate the user inputs.

v0.2.0 2020-03-29 14:48 UTC

This package is auto-updated.

Last update: 2020-03-29 14:48:47 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