Laravel Persian Validation provides validation for Persian alphabet, number and etc.
- Laravel 5.8.* | 6.x
- PHP 7.2 >=
Via Composer
$ composer require iamfarhad/validation
Add the following provider to providers part of config/app.php
Iamfarhad\Validation\ValidationServiceProvider::class
You can run vendor:publish command to have custom lang file of package on this path ( resources/lang/validation )
You can access to validation rules by passing the rules key according blew following table:
Rules | Descriptions |
---|---|
persian_alphabet | Persian alphabet |
persian_number | Persian numbers |
persian_alphabet_number | Persian alphabet and numbers |
iran_mobile | Iran mobile numbers |
sheba_number | Iran Sheba numbers |
melli_code | Iran melli code |
is_not_persian | Doesn't accept Persian alphabet and numbers |
iran_phone | Iran phone numbers |
iran_phone_area | Iran phone numbers with area code |
card_number | Payment card numbers |
iran_address | Accept Persian, English and ... alphabet, Persian and English numbers and some special characters |
iran_postal_code | Iran postal code |
Accept Persian language alphabet according to standard Persian, this is the way you can use this validation rule:
$request = [ 'فارسی' ];
$rules = [ 'persian_alphabet' ];
Validator::make( $request, $rules );
Validate Persian standard numbers (۰۱۲۳۴۵۶۷۸۹):
$request = [ '۰۱۲۳۴۵۶۷۸۹' ];
$rules = [ 'persian_number' ];
Validator::make( $request, $rules );
Validate Persian alpha num:
$request = [ 'فارسی۱۲۳۴۵۶۷۸۹' ];
$rules = [ 'persian_alphabet_number' ];
Validator::make( $request, $rules );
Validate Iran mobile phones (irancel, rightel, hamrah-e-aval, ...):
$request = [ '09381234567' ];
$rules = [ 'iran_mobile' ];
Validator::make( $request, $rules );
Validate Iran bank sheba numbers:
$request = [ 'IR062960000000100324200001' ];
$rules = [ 'sheba_number' ];
Validator::make( $request, $rules );
Validate Iran national code (melli-code):
$request = [ '3240175800' ];
$rules = [ 'melli_code' ];
Validator::make( $request, $rules );
Validate Iran payment card numbers:
$request = [ '6274129005473742' ];
$rules = [ 'card_number' ];
Validator::make( $request, $rules );
Validate Iran postal code:
$request = [ '167197-35744' ];
$rules = [ 'iran_postal_code' ];
Validator::make( $request, $rules );
$request = [ '16719735744' ];
$rules = [ 'iran_postal_code' ];
Validator::make( $request, $rules );
This component is developed by the following person(s)
Farhad Zand |
Please contribute in package completion. This is the best support.
The Laravel persian validation Module is open-sourced software licensed under the MIT license