Package Data | |
---|---|
Maintainer Username: | webalish |
Maintainer Contact: | git@alish.io (Alish) |
Package Create Date: | 2021-10-04 |
Package Last Update: | 2021-10-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-17 03:06:21 |
Package Statistics | |
---|---|
Total Downloads: | 4 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 0 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Alish Persian Validation provides validation for Persian alphabet, number and etc.
Alish Persian Validation is open-sourced software licensed under the MIT license
Via Composer
$ composer require Alishpersian/Validation
Add the following provider to providers part of config/app.php
Alishpersian\Validation\AlishValidationServiceProvider::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 | | --- | --- | | alish_alpha | Persian alphabet | | alish_num | Persian numbers | | alish_alpha_num | Persian alphabet and numbers | | iran_mobile | Iran mobile numbers | | sheba | Iran Sheba numbers | | melli_code | Iran melli code | | is_not_persian | Doesn't accept Persian alphabet and numbers | | limited_array | Check variable is array and array must be lesser and equal than parameter | | unsigned_num | Check variable is unsigned numbers | | alpha_space | Accept Persian, English and ... alphabet, space character| | a_url | Check correct URL | | a_domain | Check correct Domain | | more | Check value be max and not equal too| | less | Check value be min and not equal too | | iran_phone | Iran phone numbers | | card_number | Payment card numbers | | address | Accept Persian, English and ... alphabet, Persian and English numbers and some special characters| | iran_postal_code | Iran postal code | | package_name | Check APK package name |
Accept Persian language alphabet according to standard Persian, this is the way you can use this validation rule:
$input = [ 'فارسی' ];
$rules = [ 'alish_alpha' ];
Validator::make( $input, $rules );
Validate Persian standard numbers (۰۱۲۳۴۵۶۷۸۹):
$input = [ '۰۱۲۳۴۵۶۷۸۹' ];
$rules = [ 'alish_num' ];
Validator::make( $input, $rules );
Validate Persian alpha num:
$input = [ 'فارسی۱۲۳۴۵۶۷۸۹' ];
$rules = [ 'alish_alpha_num' ];
Validator::make( $input, $rules );
Validate Iran mobile phones (irancel, rightel, hamrah-e-aval, ...):
$input = [ '09381234567' ];
$rules = [ 'iran_mobile' ];
Validator::make( $input, $rules );
Validate Iran bank sheba numbers:
$input = [ 'IR042960000000100789200001' ];
$rules = [ 'sheba' ];
Validator::make( $input, $rules );
Validate Iran national code (melli-code):
$input = [ '3240175800' ];
$rules = [ 'melli_code' ];
Validator::make( $input, $rules );
Validate Iran payment card numbers:
$input = [ '6274129005473742' ];
$rules = [ 'card_number' ];
Validator::make( $input, $rules );
Validate Iran postal code:
$input = [ '167197-35744' ];
$rules = [ 'iran_postal_code' ];
Validator::make( $input, $rules );
$input = [ '16719735744' ];
$rules = [ 'iran_postal_code' ];
Validator::make( $input, $rules );
Here is full list of Alishpersian validation rules usage:
Validator::make( $request->all(), [
'name' => 'alish_alpha|unique|max:25', // Validate Persian alphabet, unique and max to 25 characters
'age' => 'alish_num|required', // Validate Persian numbers and check it's required
'city' => 'alish_alpha_num|min:10', // Validate persian alphabet & numbers at least 10 digit accepted
'mobile' => 'iran_mobile', // Validate mobile number
'sheba_number' => 'sheba', // Validate sheba number of bank account
'melli_code' => 'melli_code', // Validate melli code number
'latin_name' => 'is_not_persian', // Validate alphabet and doesn't contain Persian alphabet or number
'your_array' => 'limited_array:2', // Validate your array variable and must be contian 2 member or lesser
'url' => 'a_url', // Validate url
'domain' => 'a_domain', // Validate domain
'more' => 'more:10', // Validate value be more than parameter
'less' => 'less:10', // Validate value be less than parameter
'phone' => 'iran_phone', // Validate phone number
'card_number' => 'card_number', // Validate payment card number
'address' => 'address' // validate Persian, English and ... alphabet, Persian and English numbers and some special characters
'postal_code' => 'iran_postal_code' // validate iran postal code format
'package_name' => 'package_name' // validate APK package name
]);