PHP code example of xzxzyzyz / laravel-japanese-validation
1. Go to this page and download the library: Download xzxzyzyz/laravel-japanese-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/ */
xzxzyzyz / laravel-japanese-validation example snippets
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Hiragana;
Validator::make(['name' => 'ひらがなのもじれつ'], ['name' => new Hiragana])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\HiraganaAndSpace;
Validator::make(['name' => 'ひらがなの もじれつ'], ['name' => new HiraganaAndSpace])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Katakana;
Validator::make(['kana' => 'カタカナノモジレツ'], ['kana' => new Katakana])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\KatakanaAndSpace;
Validator::make(['kana' => 'カタカナノ モジレツ'], ['kana' => new KatakanaAndSpace])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Alpha;
Validator::make(['alpha' => 'ABC'], ['alpha' => new Alpha])->passes(); // true
Validator::make(['alpha' => 'ABC'], ['alpha' => new Alpha])->passes(); // false
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\AlphaDash;
Validator::make(['alpha_dash' => 'ABC-_'], ['alpha_dash' => new AlphaDash])->passes(); // true
Validator::make(['alpha_dash' => 'ABCー'], ['alpha_dash' => new AlphaDash])->passes(); // false
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\AlphaNumber;
Validator::make(['alpha_num' => 'ABC123'], ['alpha_num' => new AlphaNumber])->passes(); // true
Validator::make(['alpha_num' => 'ABC123'], ['alpha_num' => new AlphaNumber])->passes(); // false
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Phone;
Validator::make(['phone' => '00-0000-0000'], ['phone' => new Phone])->passes(); // true
Validator::make(['phone' => '0000000000'], ['phone' => new Phone])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Fax;
Validator::make(['fax' => '00-0000-0000'], ['fax' => new Fax])->passes(); // true
Validator::make(['fax' => '0000000000'], ['fax' => new Fax])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\MobilePhone;
Validator::make(['phone' => '090-1111-2222'], ['phone' => new MobilePhone])->passes(); // true
Validator::make(['phone' => '09011112222'], ['phone' => new MobilePhone])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\PostalCode;
Validator::make(['zip' => '000-0000'], ['zip' => new PostalCode])->passes(); // true
Validator::make(['zip' => '0000000'], ['zip' => new PostalCode])->passes(); // true
use Xzxzyzyz\Laravel\JapaneseValidation\Rules\Pref;
Validator::make(['pref' => '東京'], ['pref' => new Pref])->passes(); // true
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.