iamfarhad / validation by iamfarhad

laravel persian validation package
12,940
25
5
Package Data
Maintainer Username: iamfarhad
Maintainer Contact: farhad.pd@gmail.com (Farhad Zand)
Package Create Date: 2019-12-28
Package Last Update: 2024-05-12
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:22:36
Package Statistics
Total Downloads: 12,940
Monthly Downloads: 302
Daily Downloads: 0
Total Stars: 25
Total Watchers: 5
Total Forks: 6
Total Open Issues: 0

Build Status Build Status Code Intelligence Status Scrutinizer Code Quality Latest Stable Version License Total Downloads

Laravel Persian Validation

Laravel Persian Validation provides validation for Persian alphabet, number and etc.

Requirement

  • Laravel 5.8.* | 6.x
  • PHP 7.2 >=

Install

Via Composer

$ composer require iamfarhad/validation

Config

Add the following provider to providers part of config/app.php

Iamfarhad\Validation\ValidationServiceProvider::class

vendor:publish

You can run vendor:publish command to have custom lang file of package on this path ( resources/lang/validation )

Usage

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 |

Persian Alphabet

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 );

Persian numbers

Validate Persian standard numbers (۰۱۲۳۴۵۶۷۸۹):

$request = [ '۰۱۲۳۴۵۶۷۸۹' ];

$rules = [ 'persian_number' ];

Validator::make( $request, $rules );

Persian Alphabet Number

Validate Persian alpha num:

$request = [ 'فارسی۱۲۳۴۵۶۷۸۹' ];

$rules = [ 'persian_alphabet_number' ];

Validator::make( $request, $rules );

Iran mobile phone

Validate Iran mobile phones (irancel, rightel, hamrah-e-aval, ...):

$request = [ '09381234567' ];

$rules = [ 'iran_mobile' ];

Validator::make( $request, $rules );

Sheba number

Validate Iran bank sheba numbers:

$request = [ 'IR062960000000100324200001' ];

$rules = [ 'sheba_number' ];

Validator::make( $request, $rules );

Iran national code

Validate Iran national code (melli-code):

$request = [ '3240175800' ];

$rules = [ 'melli_code' ];

Validator::make( $request, $rules );

Payment card number

Validate Iran payment card numbers:

$request = [ '6274129005473742' ];

$rules = [ 'card_number' ];

Validator::make( $request, $rules );

Iran postal code

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 );

Team

This component is developed by the following person(s)

| Farhad Zand --- | | Farhad Zand

Support This Project

Please contribute in package completion. This is the best support.

License

The Laravel persian validation Module is open-sourced software licensed under the MIT license