PHPackages                             mokhosh/validation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. mokhosh/validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

mokhosh/validation
==================

Laravel persian validation

v2.9.0(1y ago)47142MITPHP

Since May 24Pushed 1y agoCompare

[ Source](https://github.com/mokhosh/validation)[ Packagist](https://packagist.org/packages/mokhosh/validation)[ RSS](/packages/mokhosh-validation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (42)Used By (0)

[![Build Status](https://camo.githubusercontent.com/0e70b0e82f4e47d28c23442473446a22ce848949c26d887f935793942d8a3c29/68747470733a2f2f7472617669732d63692e6f72672f6d6f6b686f73682f76616c69646174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mokhosh/validation)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f418f80767905eb87e1e98ce39f2c570348e5278c8c6318f24f12449d93503f2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6f6b686f73682f76616c69646174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mokhosh/validation/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/004102eda953c440051726de60d697b948e978ce5b469bd10708086f4f9040d5/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6b686f73682f76616c69646174696f6e2f762f737461626c65)](https://packagist.org/packages/mokhosh/validation)[![Total Downloads](https://camo.githubusercontent.com/25743f354c4ea41beef65cdf9306acb226a70d91a7d7f26087603b56fceabb7b/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6b686f73682f76616c69646174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/mokhosh/validation)[![License](https://camo.githubusercontent.com/9de282141e8aaebcee671057296d32a69008165a47d221b97ba491fbc5ef9ce8/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6b686f73682f76616c69646174696f6e2f6c6963656e7365)](https://github.com/mokhosh/validation/blob/master/LICENSE.md)

Laravel Persian Validation
==========================

[](#laravel-persian-validation)

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

Requirement
-----------

[](#requirement)

- Laravel 5.\*
- PHP 5.5 &gt;=

License
-------

[](#license)

Laravel Persian Validation is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

Install
-------

[](#install)

Via Composer

```
$ composer require Mokhosh/Validation
```

Config
------

[](#config)

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

```
Mokhosh\Validation\PersianValidationServiceProvider::class
```

vendor:publish
--------------

[](#vendorpublish)

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

Usage
-----

[](#usage)

You can access to validation rules by passing the rules key according blew following table:

RulesDescriptionspersian\_alphaPersian alphabetpersian\_numPersian numberspersian\_alpha\_numPersian alphabet and numbersiran\_mobileIran mobile numbersshebaIran Sheba numbersmelli\_codeIran melli codeis\_not\_persianDoesn't accept Persian alphabet and numberslimited\_arrayCheck variable is array and array must be lesser and equal than parameterunsigned\_numCheck variable is unsigned numbersalpha\_spaceAccept Persian, English and ... alphabet, space charactera\_urlCheck correct URLa\_domainCheck correct DomainmoreCheck value be max and not equal toolessCheck value be min and not equal tooiran\_phoneIran phone numberscard\_numberPayment card numbersaddressAccept Persian, English and ... alphabet, Persian and English numbers and some special charactersiran\_postal\_codeIran postal codepackage\_nameCheck APK package name### Persian Alpha

[](#persian-alpha)

Accept Persian language alphabet according to standard Persian, this is the way you can use this validation rule:

```
$input = [ 'فارسی' ];

$rules = [ 'persian_alpha' ];

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

```

### Persian numbers

[](#persian-numbers)

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

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

$rules = [ 'persian_num' ];

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

```

### Persian Alpha Num

[](#persian-alpha-num)

Validate Persian alpha num:

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

$rules = [ 'persian_alpha_num' ];

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

```

### Iran mobile phone

[](#iran-mobile-phone)

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

```
$input = [ '09381234567' ];

$rules = [ 'iran_mobile' ];

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

```

### Sheba number

[](#sheba-number)

Validate Iran bank sheba numbers:

```
$input = [ 'IR062960000000100324200001' ];

$rules = [ 'sheba' ];

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

```

### Iran national code

[](#iran-national-code)

Validate Iran national code (melli-code):

```
$input = [ '3240175800' ];

$rules = [ 'melli_code' ];

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

```

### Payment card number

[](#payment-card-number)

Validate Iran payment card numbers:

```
$input = [ '6274129005473742' ];

$rules = [ 'card_number' ];

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

```

### Iran postal code

[](#iran-postal-code)

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

```

More
----

[](#more)

Here is full list of Mokhosh validation rules usage:

```
Validator::make( $request->all(), [

  'name'          => 'persian_alpha|unique|max:25', // Validate Persian alphabet, unique and max to 25 characters

  'age'           => 'persian_num|required',  // Validate Persian numbers and check it's required

  'city'          => 'persian_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

]);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance45

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 61.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~82 days

Recently: every ~346 days

Total

40

Last Release

424d ago

Major Versions

v0.3.9 → v1.0.02017-04-19

v1.0.0 → v2.0.02017-06-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/939919859a4e4f8e56b5771bc355135f44d98d8a3926baa6ce4358d2dc090edf?d=identicon)[mokhosh](/maintainers/mokhosh)

---

Top Contributors

[![shahrokhniakan](https://avatars.githubusercontent.com/u/12880941?v=4)](https://github.com/shahrokhniakan "shahrokhniakan (70 commits)")[![imehdihosseini](https://avatars.githubusercontent.com/u/2538971?v=4)](https://github.com/imehdihosseini "imehdihosseini (13 commits)")[![mohamadx](https://avatars.githubusercontent.com/u/15182195?v=4)](https://github.com/mohamadx "mohamadx (8 commits)")[![mokhosh](https://avatars.githubusercontent.com/u/6499685?v=4)](https://github.com/mokhosh "mokhosh (6 commits)")[![AmirTheH](https://avatars.githubusercontent.com/u/10716821?v=4)](https://github.com/AmirTheH "AmirTheH (4 commits)")[![alighasemzadeh-archived](https://avatars.githubusercontent.com/u/85446576?v=4)](https://github.com/alighasemzadeh-archived "alighasemzadeh-archived (3 commits)")[![Anisi](https://avatars.githubusercontent.com/u/7829372?v=4)](https://github.com/Anisi "Anisi (3 commits)")[![vahid-almasi](https://avatars.githubusercontent.com/u/8123263?v=4)](https://github.com/vahid-almasi "vahid-almasi (2 commits)")[![majidalaeinia](https://avatars.githubusercontent.com/u/11965368?v=4)](https://github.com/majidalaeinia "majidalaeinia (2 commits)")[![mavinoo](https://avatars.githubusercontent.com/u/16878523?v=4)](https://github.com/mavinoo "mavinoo (2 commits)")[![iranrenter-group](https://avatars.githubusercontent.com/u/42575732?v=4)](https://github.com/iranrenter-group "iranrenter-group (1 commits)")

---

Tags

laravelcheckvalidationlumenvalidatepersianfarsi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mokhosh-validation/health.svg)

```
[![Health](https://phpackages.com/badges/mokhosh-validation/health.svg)](https://phpackages.com/packages/mokhosh-validation)
```

###  Alternatives

[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[sadegh19b/laravel-persian-validation

A comprehensive Laravel validation package for Persian text, numbers, dates, and Iranian national identifiers

18293.8k1](/packages/sadegh19b-laravel-persian-validation)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[iamfarhad/validation

🇮🇷 Complete Laravel Persian validation package - Iranian national ID, mobile numbers, Shamsi dates, IBAN/Sheba, postal codes &amp; more. Modern Laravel 10-12 support with both ValidationRule objects &amp; string-based rules.

2917.3k](/packages/iamfarhad-validation)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
