PHPackages                             majida/ir-validator - 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. majida/ir-validator

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

majida/ir-validator
===================

A laravel package for validate some Iranian values.

1.1(7y ago)275695MITPHPPHP &gt;=5.0

Since Aug 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/majidalavizadeh/ir-validator)[ Packagist](https://packagist.org/packages/majida/ir-validator)[ RSS](/packages/majida-ir-validator/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Iranian Validator
=================

[](#iranian-validator)

A laravel package for validate some Iranian values.

This package verify these values now :

- National Code (کدملی)
- IBAN (شماره شبا)
- Debit Card (شماره کارت بانکی)
- Postal Code (کد پستی)

Installation
------------

[](#installation)

1. Run the command below to install via Composer

```
composer require majida/ir-validator
```

2. Open your `config/app.php` and add the following to the `providers` array:

```
Majida\IrValidator\IrValidatorServiceProvider::class,
```

Usage
-----

[](#usage)

IrValidator works same as another [Laravel Validation rules](https://laravel.com/docs/validation#available-validation-rules).

### Rules

[](#rules)

- `national_code`

A rule for validating Iranian national code [(How calculated)](https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%AA_%D8%B4%D9%86%D8%A7%D8%B3%D8%A7%DB%8C%DB%8C_%D9%85%D9%84%DB%8C#%D8%AD%D8%B3%D8%A7%D8%A8_%DA%A9%D8%B1%D8%AF%D9%86_%DA%A9%D8%AF_%DA%A9%D9%86%D8%AA%D8%B1%D9%84)

```
return [
    'code' => 'required|national_code'
];
```

\--OR--

```
 $validatedData = $request->validate([
    'code' => 'national_code',
]);
```

- `iban`

A rule for validating IBAN (International Bank Account Number) known in Iran as Sheba. [(How calculated)](https://fa.wikipedia.org/wiki/%D8%A7%D9%84%DA%AF%D9%88%D8%B1%DB%8C%D8%AA%D9%85_%DA%A9%D8%AF_%D8%B4%D8%A8%D8%A7#%D8%A7%D9%84%DA%AF%D9%88%D8%B1%DB%8C%D8%AA%D9%85_%DA%A9%D8%AF_%D8%B4%D8%A8%D8%A7)

```
return [
    'account' => 'iban'
];
```

Add `false` optional parameter after `iban`, If IBAN doesn't begin with `IR`, so the validator will add `IR` as default to the account number:

```
return [
    'account' => 'iban:false'
];
```

If you want to validate non Iranian IBAN, add the 2 letters of country code after `false` optional parameter:

```
return [
    'account' => 'iban:false,DE'
];
```

- `debit_card`

A rule for validating Iranian debit cards. [(How calculated)](http://www.aliarash.com/article/creditcart/credit-debit-cart.htm)

```
return [
    'code' => 'required|debit_card'
];
```

\--OR--

```
 $validatedData = $request->validate([
    'code' => 'debit_card',
]);
```

You can add an optional parameter if you want to validate a card from a specific bank:

```
return [
    'code' => 'required|debit_card:bmi'
];
```

List of the bank codes:

- bmi (بانک ملی)
- banksepah (بانک سپه)
- edbi (بانک توصعه صادرات)
- bim (بانک صنعت و معدن)
- bki (بانک کشاورزی)
- bank-maskan (بانک مسکن)
- postbank (پست بانک ایران)
- ttbank (بانک توسعه تعاون)
- enbank (بانک اقتصاد نوین)
- parsian-bank (بانک پارسیان)
- bpi (بانک پاسارگاد)
- karafarinbank (بانک کارآفرین)
- sb24 (بانک سامان)
- sinabank (بانک سینا)
- sbank (بانک سرمایه)
- shahr-bank (بانک شهر)
- bank-day (بانک دی)
- bsi (بانک صادرات)
- bankmellat (بانک ملت)
- tejaratbank (بانک تجارت)
- refah-bank (بانک رفاه)
- ansarbank (بانک انصار)
- mebank (بانک مهر اقتصاد)
- `postal_code`

```
return [
    'code' => 'required|postal_code'
];
```

\--OR--

```
 $validatedData = $request->validate([
    'code' => 'postal_code',
]);
```

Contribute
----------

[](#contribute)

Contributions to the package are always welcome!

- Report any idea, bugs or issues you find on the [issue tracker](https://github.com/majidalavizadeh/ir-validator/issues).
- You can grab the source code at the package's [Git repository](https://github.com/majidalavizadeh/ir-validator).

License
-------

[](#license)

All contents of this package are licensed under the [MIT license](https://github.com/majidalavizadeh/ir-validator/blob/master/LICENSE.md).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~0 days

Total

2

Last Release

2879d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3766252?v=4)[majida](/maintainers/majida)[@Majida](https://github.com/Majida)

---

Top Contributors

[![majidalavizadeh](https://avatars.githubusercontent.com/u/1640821?v=4)](https://github.com/majidalavizadeh "majidalavizadeh (4 commits)")[![satrobit](https://avatars.githubusercontent.com/u/7242206?v=4)](https://github.com/satrobit "satrobit (4 commits)")

---

Tags

laravelvalidationcodenationalIBANmelliiraniansheba

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/majida-ir-validator/health.svg)

```
[![Health](https://phpackages.com/badges/majida-ir-validator/health.svg)](https://phpackages.com/packages/majida-ir-validator)
```

###  Alternatives

[propaganistas/laravel-phone

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

3.0k38.3M139](/packages/propaganistas-laravel-phone)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

761621.7k17](/packages/wendelladriel-laravel-validated-dto)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2422.3M6](/packages/laravel-validation-rules-credit-card)[intervention/validation

Additional validation rules for the Laravel framework

6777.1M18](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

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

1.1k2.3M50](/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-13 support with both ValidationRule objects &amp; string-based rules.

3017.3k](/packages/iamfarhad-validation)

PHPackages © 2026

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