PHP code example of tinywan / validate

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

    

tinywan / validate example snippets


$data = [
    'name'  => 'Tinywan',
    'age'  => 24,
    'email' => '[email protected]'
];
validate($data, \app\index\validate\UserValidate::class);

$validate = \Tinywan\Validate\Facade\Validate::rule('age', 'number|between:1,120')
    ->rule([
        'name'  => 'validate->check($data)) {
    var_dump($validate->getError());
}

namespace app\index\validate;

use Tinywan\Validate\Validate;

class UserValidate extends Validate
{
    protected array $rule =   [
        'name'  => ' => '名称必须',
        'name.max'     => '名称最多不能超过25个字符',
        'age.