seeds-std / laravel-jp-validation-rules
Validate Jp rules
Installs: 3 534
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- illuminate/contracts: ^5.5|^6.0|^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^3.8|^4|^5|^6
- phpunit/phpunit: ^7|^8|^9
This package is not auto-updated.
Last update: 2021-12-09 08:20:32 UTC
README
Installation
composer require seeds-std/laravel-jp-validation-rules
Usage
Hiragana
Validator::make(['name' => 'やまだたろう'], ['name' => new \SeedsStd\JpValidationRules\Hiragana()]) ->passes(); // true
ZenkakuKatakana
Validator::make(['name' => 'ヤマダタロウ'], ['name' => new \SeedsStd\JpValidationRules\ZenkakuKatakana()]) ->passes(); // true
HankakuKatakana
Validator::make(['name' => 'ヤマダタロウ'], ['name' => new \SeedsStd\JpValidationRules\HankakuKatakana()]) ->passes(); // true
PhoneNumber
Validator::make(['phone_number' => '0120123456'], ['phone_number' => new \SeedsStd\JpValidationRules\PhoneNumber()]) ->passes(); // true
Validator::make(['phone_number' => '+81120123456'], ['phone_number' => new \SeedsStd\JpValidationRules\PhoneNumber(['allow_country_code' => true])]) ->passes(); // true
Postcode
Validator::make(['postcode' => '111-2222'], ['postcode' => new \SeedsStd\JpValidationRules\Postcode()]) ->passes(); // true
Translation
Translate validation messages with resources/lang/ja/validation.php
<?php return [ 'hiragana' => ':attributeはひらがなを指定してください。', 'zenkaku_katakana' => ':attributeは全角カタカナを指定してください。', 'hankaku_katakana' => ':attributeは半角カタカナを指定してください。', 'jp_postcode' => ':attributeは正しい郵便番号の形式を指定してください。', 'jp_phone_number' => ':attributeは正しい電話番号の形式を指定してください。', ];