Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Logo

Total Downloads Latest Stable Version License

About

Provide additional validation rules to support Vietnamese testing for Laravel.

Condition

  • Laravel 8.x or later
  • PHP 8.1 or later

Installation

You can install the package via composer:

composer require sphoton/validation

Available Rules

  • VietnameseRule: The field under validation must be entirely in Vietnamese.
  • VietnameseNumberRule: The field under validation must be entirely in Vietnamese and number.

Usage

You can use the validation rules in your Laravel application like this:

use Sphoton\Validation\Rules\VietnameseRule;
use Sphoton\Validation\Rules\VietnameseNumberRule;

$request->validate([
    'name'      => ['required', 'string', new VietnameseRule],
    'address'   => ['required', 'string', new VietnameseNumberRule],
]);
use Sphoton\Validation\Rules\VietnameseRule;
"Nguyen Van A"          // Pass
"Nguyễn Văn A"          // Pass
"Nguyễn Văn A 123"      // Fail
"123 Nguyễn Văn A"      // Fail
"Nguyễn Văn A @"        // Fail
"Nguyễn Văn A 123 @"    // Fail
"Nguyễn Văn 
A"                      // Fail
"Nguyễn Văn \nA"        // Fail

use Sphoton\Validation\Rules\VietnameseNumberRule;
"Nguyen Van A"          // Pass
"Nguyễn Văn A 123"      // Pass
"123 Nguyễn Văn A"      // Pass
"Nguyễn Văn A @"        // Fail
"Nguyễn Văn A 123 @"    // Fail
"Nguyễn Văn
A"                      // Fail
"Nguyễn Văn \nA"        // Fail

Contributors

Hoàng
Hoàng Khắc Phúc
DNT/
DNT

About

Validation for Laravel Framework

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages