1. Go to this page and download the library: Download phpviet/yii-validation 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/ */
phpviet / yii-validation example snippets
// Khai báo trong `Model`:
public function rules()
{
return [
[['mobile_number'], 'mobile_vn']
];
}
// Khai báo trong `Model`:
public function rules()
{
return [
[['land_line_number'], 'land_line_vn']
];
}
// Khai báo trong `Model`:
public function rules()
{
return [
[['id_number'], 'id_vn']
];
}
// Khai báo trong `Model`:
public function rules()
{
return [
[['ip_address'], 'ip_vn'], // Kiểm tra tất cả ipv4 HOẶC v6 chỉ cần ip trong nước là được.
[['ip_address'], 'ipv4_vn'], // Kiểm tra phải là ipv4 trong nước.
[['ip_address'], 'ipv6_vn'] // Kiểm tra phải là ipv6 trong nước.
];
}