Micro Engine Form Validate

Micro Engine Form Validate

Enhanced form validate - Manage validate scene

Get Started →

starsforksDocument
class UserValidate extends Validate
{
    protected $rule = [
        'user' => 'required|email',
        'pass' => 'required|lengthBetween:6,16',
        'name' => 'required|chs'
    ];
    
    protected $scene = [
        'login'    => ['user', 'pass'],
        'register' => ['user', 'pass', 'name'],
    ];
}

// Login Business
$data = (new UserValidate())->scene('login')->check($userInput);

// Registration Business
$data = (new UserValidate())->scene('register')->check($userInput);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Rules Management

Easy and fast management, generation and extraction of required validation rules, reusable rules and private rules

Validation Scene

Arbitrary combination of validation rules, dynamic generation of appropriate validation rules

Error message

Multiple error message definition methods, default rule messages, and support for multiple variables to use, making your interactions more clear and understandable