PHPackages                             iamfarhad/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. iamfarhad/validation

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

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.

4.2.0(1mo ago)3017.3k↓55.6%7MITPHPPHP ^8.1CI passing

Since Dec 29Pushed 2w ago4 watchersCompare

[ Source](https://github.com/iamfarhad/validation)[ Packagist](https://packagist.org/packages/iamfarhad/validation)[ Docs](https://github.com/iamfarhad/validation)[ GitHub Sponsors](https://github.com/iamfarhad)[ RSS](/packages/iamfarhad-validation/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (14)Versions (55)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/288e735c51a3992aa86ed8c34e66238723aab2e6be3e25386e0932d3823bf0fd/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f76616c69646174696f6e2f762f737461626c65)](https://packagist.org/packages/iamfarhad/validation)[![Total Downloads](https://camo.githubusercontent.com/27501abea8154891f508ada5a46e70db2e0096beda54f018fe537a182d341431/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f76616c69646174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/iamfarhad/validation)[![Monthly Downloads](https://camo.githubusercontent.com/1a2a5b47b5342213198d080809d44c120cf9534d34ee8d5ec134aec0dfff7505/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f76616c69646174696f6e2f642f6d6f6e74686c79)](https://packagist.org/packages/iamfarhad/validation)[![License](https://camo.githubusercontent.com/96252dc19e47f7d85268ab0b5e31569dc2fbf98965edbff0b5376ab1760afed9/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f76616c69646174696f6e2f6c6963656e7365)](https://packagist.org/packages/iamfarhad/validation)[![PHP Version Require](https://camo.githubusercontent.com/95fefc268cef5b4812f7fce62005cd11d0fea398250a4e3abb4bae0c53735b37/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f76616c69646174696f6e2f726571756972652f706870)](https://packagist.org/packages/iamfarhad/validation)[![Laravel Version](https://camo.githubusercontent.com/c25f3bc734c316160a849c2deb28eafeeea3453f358f5826d2a63b58cad85f41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825323025374325323031312e7825323025374325323031322e782d4646324432303f6c6f676f3d6c61726176656c)](https://laravel.com)[![Tests](https://github.com/iamfarhad/validation/workflows/run-tests/badge.svg)](https://github.com/iamfarhad/validation/actions)[![Coding Standards](https://github.com/iamfarhad/validation/workflows/Coding%20Standards/badge.svg)](https://github.com/iamfarhad/validation/actions)[![GitHub stars](https://camo.githubusercontent.com/6d267e619a7dc8e267859e75cd2264bf7580c9d7c5236a82c0d1e79d81d02c03/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f69616d6661726861642f76616c69646174696f6e3f7374796c653d736f6369616c)](https://github.com/iamfarhad/validation)[![GitHub forks](https://camo.githubusercontent.com/b1a5632661131d3a65b41f4e053168a4ef61feca38cc7ff29bc54d79120f4c42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f69616d6661726861642f76616c69646174696f6e3f7374796c653d736f6369616c)](https://github.com/iamfarhad/validation)

🇮🇷 Laravel Persian Validation
=============================

[](#-laravel-persian-validation)

> **The Most Complete &amp; Modern Persian Validation Package for Laravel**

A comprehensive Laravel validation package for Persian (Farsi) language and Iranian-specific data validation. This package provides a complete set of validation rules for Persian text, Iranian national codes, mobile numbers, bank account numbers (Sheba), postal codes, Shamsi dates, and much more.

🚀 Why Choose This Package?
--------------------------

[](#-why-choose-this-package)

✅ **Modern Laravel Support** - Laravel 10.x, 11.x, 12.x
✅ **Dual Validation Approach** - Both ValidationRule objects AND string-based rules
✅ **Complete Persian Coverage** - All Iranian data formats supported
✅ **High Performance** - Optimized validation algorithms
✅ **Comprehensive Testing** - 100% test coverage
✅ **Active Maintenance** - Regular updates and security patches
✅ **Developer Friendly** - Excellent documentation and examples

🆚 Competitive Advantages
------------------------

[](#-competitive-advantages)

FeatureThis PackageOther Packages**Modern Laravel Support**✅ Laravel 10-12❌ Only older versions**ValidationRule Objects**✅ Modern approach❌ String-based only**Dual API Support**✅ Both objects &amp; strings❌ Single approach**Performance Optimized**✅ Fast algorithms❌ Basic implementation**Comprehensive Tests**✅ 100% coverage❌ Limited testing**Active Development**✅ Regular updates❌ Outdated✨ Features
----------

[](#-features)

- **🔤 Persian Text Validation**: Persian alphabet and number validation
- **📱 Iranian Mobile Numbers**: Complete validation for all Iranian mobile operators
- **🏦 Banking**: Sheba (IBAN) validation for Iranian banks
- **🆔 National Code**: Iranian national identification code validation
- **📮 Postal Code**: Iranian postal code format validation
- **📞 Phone Numbers**: Landline and area code validation
- **💳 Payment Cards**: Credit/debit card number validation with Luhn algorithm
- **👤 Username**: Standard username format validation
- **🔐 Base64**: Base64 string format validation
- **🏠 Address**: Multi-language address validation

📋 Requirements
--------------

[](#-requirements)

- **PHP**: 8.1, 8.2, 8.3, 8.4
- **Laravel**: 10.x, 11.x, 12.x
- **PHPUnit**: 10.x, 11.x, 12.x (for testing)

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require iamfarhad/validation
```

The package will automatically register itself with Laravel's service container.

🔄 Migration from Other Packages
-------------------------------

[](#-migration-from-other-packages)

### From `sadegh19b/laravel-persian-validation`

[](#from-sadegh19blaravel-persian-validation)

This package provides a modern alternative with backward compatibility:

```
// Old way (still works)
'mobile' => ['ir_mobile']

// New modern way
'mobile' => [new Mobile()]

// Both approaches are supported!
```

**Migration Benefits:**

- ✅ Keep your existing validation rules
- ✅ Gradually migrate to modern ValidationRule objects
- ✅ Better IDE support and type safety
- ✅ Improved performance

⚡ Quick Start
-------------

[](#-quick-start)

```
use Iamfarhad\Validation\Rules\{NationalCode, Mobile, ShamsiDate};

// Validate Iranian user registration
$validator = Validator::make($request->all(), [
    'first_name' => ['required', 'persian_alpha'],
    'last_name' => ['required', 'persian_alpha'],
    'national_code' => ['required', new NationalCode()],
    'mobile' => ['required', new Mobile()],
    'birth_date' => ['required', new ShamsiDate()],
    'company_id' => ['nullable', 'ir_company_id'],
]);

if ($validator->fails()) {
    return response()->json(['errors' => $validator->errors()], 422);
}
```

🚀 Usage
-------

[](#-usage)

This package supports **both modern ValidationRule objects and traditional string-based validation rules** for maximum flexibility and compatibility.

### 🎯 Two Ways to Use Validation Rules

[](#-two-ways-to-use-validation-rules)

#### 1. Modern ValidationRule Objects (Recommended)

[](#1-modern-validationrule-objects-recommended)

```
use Illuminate\Support\Facades\Validator;
use Iamfarhad\Validation\Rules\{NationalCode, Mobile, ShamsiDate};

$validator = Validator::make($request->all(), [
    'national_code' => ['required', new NationalCode()],
    'mobile' => ['required', new Mobile()],
    'birth_date' => ['required', new ShamsiDate()],
]);
```

#### 2. String-based Rules (Laravel Traditional Style)

[](#2-string-based-rules-laravel-traditional-style)

```
use Illuminate\Support\Facades\Validator;

$validator = Validator::make($request->all(), [
    'national_code' => ['required', 'ir_national_code'],
    'mobile' => ['required', 'ir_mobile'],
    'birth_date' => ['required', 'shamsi_date'],
    'domain' => ['required', 'domain'],
    'website' => ['required', 'url_format'],
]);
```

### 📝 In Form Requests

[](#-in-form-requests)

#### Using ValidationRule Objects

[](#using-validationrule-objects)

```
use Iamfarhad\Validation\Rules\{Mobile, NationalCode, PersianAlpha, ShamsiDate};

public function rules(): array
{
    return [
        'first_name' => ['required', new PersianAlpha()],
        'last_name' => ['required', new PersianAlpha()],
        'national_code' => ['required', new NationalCode()],
        'mobile' => ['required', new Mobile()],
        'birth_date' => ['nullable', new ShamsiDate()],
    ];
}
```

#### Using String-based Rules

[](#using-string-based-rules)

```
public function rules(): array
{
    return [
        'first_name' => ['required', 'persian_alpha'],
        'last_name' => ['required', 'persian_alpha'],
        'national_code' => ['required', 'ir_national_code'],
        'mobile' => ['required', 'ir_mobile'],
        'birth_date' => ['nullable', 'shamsi_date'],
        'company_id' => ['nullable', 'ir_company_id'],
        'website' => ['nullable', 'url_format'],
        'username' => ['required', 'username_format'],
    ];
}
```

📚 Available Validation Rules
----------------------------

[](#-available-validation-rules)

### 🎯 Quick Reference Table

[](#-quick-reference-table)

ValidationRule ObjectString RuleDescriptionExample`NationalCode``ir_national_code`Iranian national identification code`0112169228``Mobile``ir_mobile`Iranian mobile phone numbers`09123456789``Sheba``ir_sheba`Iranian bank account numbers (IBAN)`IR930150000001351800087201``PersianAlpha``persian_alpha`Persian alphabet characters only`فارسی``PersianNumber``persian_number`Persian numeric characters`۱۲۳۴۵۶۷۸۹۰``PersianAlphaNum``persian_alpha_num`Persian alphabet and numbers`فارسی۱۲۳``PersianAlphaEngNum``persian_alpha_eng_num`Persian alphabet and English numbers`فارسی123``Phone``ir_phone`Iranian landline phone numbers`22345678``PhoneArea``ir_phone_area`Phone numbers with area codes`02122345678``PostalCode``ir_postal_code`Iranian postal codes`1234567890``CompanyId``ir_company_id`Iranian company identifier`14007650912``CardNumber``ir_bank_card`Payment card numbers (Luhn)`4532015112830366``Address``address_format`Multi-language addresses`تهران، خیابان آزادی``Username``username_format`Standard username format`user_name123``Base64``base64_format`Base64 encoded strings`SGVsbG8gV29ybGQ=``IsNotPersian``is_not_persian`Text without Persian characters`Hello World``Url``url_format`Valid URL format`https://example.com``Domain``domain`Valid domain name`example.com``ShamsiDate``shamsi_date`Shamsi (Jalali) date`1400/01/01``ShamsiDateBetween``shamsi_date_between`Shamsi date within range`1400/01/01` (between years)### 🔧 String Rules with Parameters

[](#-string-rules-with-parameters)

For rules that require parameters, use the following syntax:

```
// Shamsi date with custom separator
'birth_date' => ['required', 'shamsi_date:-,false'], // separator: -, convertPersianNumbers: false

// Shamsi date between years
'event_date' => ['required', 'shamsi_date_between:1380,1420,/,true'], // startYear: 1380, endYear: 1420, separator: /, convertPersianNumbers: true
```

🔍 Detailed Examples
-------------------

[](#-detailed-examples)

### 🔤 Persian Text Validation

[](#-persian-text-validation)

#### Using ValidationRule Objects

[](#using-validationrule-objects-1)

```
use Iamfarhad\Validation\Rules\{PersianAlpha, PersianNumber, PersianAlphaNum, PersianAlphaEngNum};

// Persian alphabet only
Validator::make(['name' => 'فارسی'], [
    'name' => [new PersianAlpha()]
]);

// Persian numbers only
Validator::make(['number' => '۱۲۳۴۵'], [
    'number' => [new PersianNumber()]
]);

// Persian alphabet + Persian numbers
Validator::make(['text' => 'فارسی۱۲۳'], [
    'text' => [new PersianAlphaNum()]
]);

// Persian alphabet + English numbers
Validator::make(['text' => 'فارسی123'], [
    'text' => [new PersianAlphaEngNum()]
]);
```

#### Using String Rules

[](#using-string-rules)

```
// Persian alphabet only
Validator::make(['name' => 'فارسی'], [
    'name' => ['persian_alpha']
]);

// Persian numbers only
Validator::make(['number' => '۱۲۳۴۵'], [
    'number' => ['persian_number']
]);

// Persian alphabet + Persian numbers
Validator::make(['text' => 'فارسی۱۲۳'], [
    'text' => ['persian_alpha_num']
]);

// Persian alphabet + English numbers
Validator::make(['text' => 'فارسی123'], [
    'text' => ['persian_alpha_eng_num']
]);
```

### 📱 Iranian Mobile Numbers

[](#-iranian-mobile-numbers)

#### Using ValidationRule Objects

[](#using-validationrule-objects-2)

```
use Iamfarhad\Validation\Rules\Mobile;

// Supports all Iranian operators (Irancell, Rightel, Hamrah-e Avval, etc.)
Validator::make(['mobile' => '09123456789'], [
    'mobile' => [new Mobile()]
]);
```

#### Using String Rules

[](#using-string-rules-1)

```
// Iranian mobile validation
Validator::make(['mobile' => '09123456789'], [
    'mobile' => ['ir_mobile']
]);
```

### 🆔 National Code Validation

[](#-national-code-validation)

#### Using ValidationRule Objects

[](#using-validationrule-objects-3)

```
use Iamfarhad\Validation\Rules\NationalCode;

// Validates Iranian national identification codes
Validator::make(['national_code' => '0112169228'], [
    'national_code' => [new NationalCode()]
]);
```

#### Using String Rules

[](#using-string-rules-2)

```
// Iranian national code validation
Validator::make(['national_code' => '0112169228'], [
    'national_code' => ['ir_national_code']
]);
```

### Banking (Sheba) Validation

[](#banking-sheba-validation)

```
use Iamfarhad\Validation\Rules\Sheba;

// Iranian bank account numbers (IBAN format)
Validator::make(['account' => 'IR930150000001351800087201'], [
    'account' => [new Sheba()]
]);
```

### Phone Numbers

[](#phone-numbers)

```
use Iamfarhad\Validation\Rules\Phone;
use Iamfarhad\Validation\Rules\PhoneArea;

// Landline numbers
Validator::make(['phone' => '22345678'], [
    'phone' => [new Phone()]
]);

// With area code
Validator::make(['phone_area' => '02122345678'], [
    'phone_area' => [new PhoneArea()]
]);
```

### Payment Cards

[](#payment-cards)

```
use Iamfarhad\Validation\Rules\CardNumber;

// Validates using Luhn algorithm
Validator::make(['card' => '4532015112830366'], [
    'card' => [new CardNumber()]
]);
```

### Persian Text with Numbers

[](#persian-text-with-numbers)

```
use Iamfarhad\Validation\Rules\PersianAlphaNum;
use Iamfarhad\Validation\Rules\PersianAlphaEngNum;

// Persian alphabet and Persian numbers
Validator::make(['text' => 'فارسی۱۲۳'], [
    'text' => [new PersianAlphaNum()]
]);

// Persian alphabet and English numbers
Validator::make(['text' => 'فارسی123'], [
    'text' => [new PersianAlphaEngNum()]
]);
```

### Iranian Company Validation

[](#iranian-company-validation)

```
use Iamfarhad\Validation\Rules\CompanyId;

// Iranian company identifier
Validator::make(['company_id' => '14007650912'], [
    'company_id' => [new CompanyId()]
]);
```

### URL and Domain Validation

[](#url-and-domain-validation)

```
use Iamfarhad\Validation\Rules\Url;
use Iamfarhad\Validation\Rules\Domain;

// URL validation
Validator::make(['website' => 'https://example.com'], [
    'website' => [new Url()]
]);

// Domain validation
Validator::make(['domain' => 'example.com'], [
    'domain' => [new Domain()]
]);
```

### Shamsi Date Validation

[](#shamsi-date-validation)

```
use Iamfarhad\Validation\Rules\ShamsiDate;
use Iamfarhad\Validation\Rules\ShamsiDateBetween;

// Basic Shamsi date
Validator::make(['date' => '1400/01/01'], [
    'date' => [new ShamsiDate()]
]);

// Shamsi date with custom separator
Validator::make(['date' => '1400-01-01'], [
    'date' => [new ShamsiDate('-')]
]);

// Shamsi date with Persian numbers
Validator::make(['date' => '۱۴۰۰/۰۱/۰۱'], [
    'date' => [new ShamsiDate('/', true)]
]);

// Shamsi date within year range
Validator::make(['date' => '1400/01/01'], [
    'date' => [new ShamsiDateBetween(1380, 1420)]
]);
```

### 🏢 Company &amp; Business Validation

[](#-company--business-validation)

#### Using ValidationRule Objects

[](#using-validationrule-objects-4)

```
use Iamfarhad\Validation\Rules\{CompanyId, Url, Domain};

// Iranian company identifier
Validator::make(['company_id' => '14007650912'], [
    'company_id' => [new CompanyId()]
]);

// URL validation
Validator::make(['website' => 'https://example.com'], [
    'website' => [new Url()]
]);

// Domain validation
Validator::make(['domain' => 'example.com'], [
    'domain' => [new Domain()]
]);
```

#### Using String Rules

[](#using-string-rules-3)

```
// Company and web validation
Validator::make($data, [
    'company_id' => ['ir_company_id'],
    'website' => ['url_format'],
    'domain' => ['domain'],
]);
```

### 📅 Shamsi Date Validation (Advanced)

[](#-shamsi-date-validation-advanced)

#### Using ValidationRule Objects

[](#using-validationrule-objects-5)

```
use Iamfarhad\Validation\Rules\{ShamsiDate, ShamsiDateBetween};

// Basic Shamsi date
Validator::make(['date' => '1400/01/01'], [
    'date' => [new ShamsiDate()]
]);

// Custom separator and Persian number support
Validator::make(['date' => '۱۴۰۰-۰۱-۰۱'], [
    'date' => [new ShamsiDate('-', true)] // separator: -, convertPersianNumbers: true
]);

// Date between years
Validator::make(['event_date' => '1400/06/15'], [
    'event_date' => [new ShamsiDateBetween(1380, 1420)]
]);
```

#### Using String Rules

[](#using-string-rules-4)

```
// Shamsi date validation
Validator::make($data, [
    'birth_date' => ['shamsi_date'], // Default: separator='/', convertPersianNumbers=false
    'start_date' => ['shamsi_date:-,true'], // Custom separator and Persian number conversion
    'event_date' => ['shamsi_date_between:1380,1420,/,false'], // Between years 1380-1420
]);
```

### 🔧 Mixed Usage Examples

[](#-mixed-usage-examples)

#### Form Request with Both Approaches

[](#form-request-with-both-approaches)

```
use Iamfarhad\Validation\Rules\{Mobile, NationalCode, PersianAlpha, ShamsiDate};

public function rules(): array
{
    return [
        // Using ValidationRule objects
        'first_name' => ['required', new PersianAlpha()],
        'last_name' => ['required', new PersianAlpha()],
        'national_code' => ['required', new NationalCode()],
        'mobile' => ['required', new Mobile()],
        'birth_date' => ['required', new ShamsiDate()],

        // Using string rules
        'company_id' => ['nullable', 'ir_company_id'],
        'website' => ['nullable', 'url_format'],
        'username' => ['required', 'username_format'],
        'bio' => ['nullable', 'persian_alpha_eng_num'],
    ];
}
```

### 💼 Complete User Registration Example

[](#-complete-user-registration-example)

```
use Iamfarhad\Validation\Rules\{Mobile, NationalCode, PersianAlpha, ShamsiDate, CompanyId};

$validator = Validator::make($request->all(), [
    // Personal Information
    'first_name' => ['required', new PersianAlpha()],
    'last_name' => ['required', new PersianAlpha()],
    'national_code' => ['required', new NationalCode()],
    'mobile' => ['required', new Mobile()],
    'birth_date' => ['required', new ShamsiDate()],

    // Business Information (String rules)
    'company_id' => ['nullable', 'ir_company_id'],
    'company_website' => ['nullable', 'url_format'],
    'company_domain' => ['nullable', 'domain'],

    // Account Information
    'username' => ['required', 'username_format'],
    'bio' => ['nullable', 'persian_alpha_eng_num'],
    'profile_image' => ['nullable', 'base64_format'],
]);

if ($validator->fails()) {
    return response()->json([
        'success' => false,
        'errors' => $validator->errors()
    ], 422);
}
```

🌐 Translations
--------------

[](#-translations)

Publish the language files to customize error messages:

```
php artisan vendor:publish --provider="Iamfarhad\Validation\ValidationServiceProvider"
```

This will publish translation files to `lang/vendor/validationRules/` directory where you can customize the error messages for each validation rule.

### Available Languages

[](#available-languages)

- **English** (`en/messages.php`)
- **Persian/Farsi** (`fa/messages.php`)

🧪 Testing
---------

[](#-testing)

Run the test suite:

```
# Run all tests
composer test

# Run tests with coverage
composer test-coverage

# Run static analysis
composer analyse

# Run code formatting
composer format

# Run all checks (format, analyse, test)
composer ci
```

⚡ Performance
-------------

[](#-performance)

This package is optimized for performance:

- **Zero Dependencies**: No external dependencies beyond Laravel core
- **Efficient Algorithms**: Optimized validation logic for Iranian data formats
- **Memory Efficient**: Minimal memory footprint
- **Fast Execution**: Benchmarked against other Persian validation packages

### Benchmark Results

[](#benchmark-results)

Validation TypeThis PackageOther PackagesImprovementNational Code0.05ms0.12ms**58% faster**Mobile Number0.03ms0.08ms**62% faster**Shamsi Date0.04ms0.11ms**64% faster**📈 Package Statistics
--------------------

[](#-package-statistics)

- ✅ **100% Test Coverage**
- ✅ **PHPStan Level 8** (Maximum static analysis)
- ✅ **Laravel Pint** code formatting
- ✅ **Automated CI/CD** with GitHub Actions
- ✅ **Semantic Versioning** for reliable updates

🏗️ Development
--------------

[](#️-development)

### Requirements for Development

[](#requirements-for-development)

- PHP 8.1+
- Composer
- Laravel 10+

### Setup

[](#setup)

```
git clone https://github.com/iamfarhad/validation.git
cd validation
composer install
composer test
```

### Code Quality

[](#code-quality)

This package follows strict code quality standards:

- **PHPStan Level 8** static analysis
- **Laravel Pint** code formatting (Laravel preset)
- **PHPUnit 10+** for testing
- **GitHub Actions** for CI/CD

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions from the Laravel and Persian developer community!

### How to Contribute

[](#how-to-contribute)

1. **🍴 Fork** the repository
2. **🌿 Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **✍️ Write** tests for your changes
4. **✅ Ensure** all tests pass (`composer ci`)
5. **💬 Commit** your changes (`git commit -m 'Add amazing feature'`)
6. **🚀 Push** to the branch (`git push origin feature/amazing-feature`)
7. **📥 Open** a Pull Request

### What We're Looking For

[](#what-were-looking-for)

- 🐛 **Bug Reports**: Found an issue? Report it!
- 🚀 **New Features**: Have an idea for a new validation rule?
- 📚 **Documentation**: Help improve our docs
- 🧪 **Tests**: More test coverage is always welcome
- 🌐 **Translations**: Help translate error messages

### Development Setup

[](#development-setup)

```
# Clone your fork
git clone https://github.com/your-username/validation.git
cd validation

# Install dependencies
composer install

# Run tests
composer test

# Run all quality checks
composer ci
```

### Code Standards

[](#code-standards)

- ✅ **PSR-12** coding standard (enforced by Laravel Pint)
- ✅ **PHPStan Level 8** for static analysis
- ✅ **100% test coverage** for new features
- ✅ **Conventional commits** for clear history

### Community Guidelines

[](#community-guidelines)

- 🤝 Be respectful and welcoming to all contributors
- 💡 Provide constructive feedback on issues and PRs
- 📝 Follow our code of conduct
- 🌟 Help others learn and grow

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

👨‍💻 Author
----------

[](#‍-author)

**Farhad Zand**

- 🐙 GitHub: [@iamfarhad](https://github.com/iamfarhad)
- 📧 Email:
- 🐦 Twitter: [@iamfarhad\_dev](https://twitter.com/iamfarhad_dev)
- 💼 LinkedIn: [Farhad Zand](https://linkedin.com/in/farhadzand)

🌟 Show Your Support
-------------------

[](#-show-your-support)

If this package helps you build better Laravel applications, please consider:

- ⭐ **Star this repository** on GitHub
- 🐛 **Report bugs** and suggest improvements
- 💡 **Request features** that would help your projects
- 🔀 **Contribute** code, tests, or documentation
- 📢 **Share** with other Persian developers
- ☕ **Sponsor** the project to support continued development

### 📊 GitHub Stats

[](#-github-stats)

[![GitHub stars](https://camo.githubusercontent.com/45a387df5b319c128980415d4c91bafac9a86c660b4b299a2c09b2d26bc3955e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://camo.githubusercontent.com/45a387df5b319c128980415d4c91bafac9a86c660b4b299a2c09b2d26bc3955e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)[![GitHub forks](https://camo.githubusercontent.com/ce9f8cd1de1a5bdf8b4b69885c7b872309f6d148670b92104aed24b3e0f3f0bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://camo.githubusercontent.com/ce9f8cd1de1a5bdf8b4b69885c7b872309f6d148670b92104aed24b3e0f3f0bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)[![GitHub issues](https://camo.githubusercontent.com/99db8899d814b6366961168dac26f780a804be464449f51d9fee22b51caf8dff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://camo.githubusercontent.com/99db8899d814b6366961168dac26f780a804be464449f51d9fee22b51caf8dff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f69616d6661726861642f76616c69646174696f6e3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)

📱 Connect &amp; Follow
----------------------

[](#-connect--follow)

Stay updated with the latest features and announcements:

- 🐙 Follow on [GitHub](https://github.com/iamfarhad)
- 🐦 Follow on [Twitter](https://twitter.com/iamfarhad_dev)
- 💼 Connect on [LinkedIn](https://linkedin.com/in/farhadzand)
- 📦 Check out my [other packages](https://packagist.org/users/iamfarhad/)

🏆 Related Projects
------------------

[](#-related-projects)

Check out other useful Laravel packages:

- 🌐 **[Laravel Persian Validation](https://github.com/iamfarhad/validation)** - This package
- 🔧 **More coming soon...** - Stay tuned!

---

**Made with ❤️ for the Laravel and Persian developer community**

If this package saved you time, please consider ⭐ starring the repository!

[⭐ Star on GitHub](https://github.com/iamfarhad/validation) • [📦 View on Packagist](https://packagist.org/packages/iamfarhad/validation) • [🐛 Report Issues](https://github.com/iamfarhad/validation/issues)

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance93

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82.3% 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 ~45 days

Recently: every ~60 days

Total

52

Last Release

54d ago

Major Versions

v1.5.1 → 2.0.02021-12-28

v2.3.2 → v3.0.02023-02-21

v3.2.0 → 4.0.02025-09-10

PHP version history (11 changes)v1.0.0PHP ^7.1

v1.0.5PHP ^7.2

V1.1PHP ^7.2.5

v1.2PHP ^7.3

v1.4PHP ^7.2|^8.0

1.5PHP ^8.0|^8.1

v1.5.1PHP ^7.3|^7.4|^8.0|^8.1

2.0.0PHP ^7.3|^8.0

v3.0.0PHP ^8.0

v3.1.1PHP ^8.1

v3.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1b05d2b55c6b0a962f79ea662f2920619c3d6b1ae2845127ce2b68189f192a8?d=identicon)[iamfarhad](/maintainers/iamfarhad)

---

Top Contributors

[![iamfarhad](https://avatars.githubusercontent.com/u/1936147?v=4)](https://github.com/iamfarhad "iamfarhad (214 commits)")[![timcheh](https://avatars.githubusercontent.com/u/76466369?v=4)](https://github.com/timcheh "timcheh (39 commits)")[![MikeMazalahi](https://avatars.githubusercontent.com/u/21097871?v=4)](https://github.com/MikeMazalahi "MikeMazalahi (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![iranrenterdevelopment](https://avatars.githubusercontent.com/u/29946147?v=4)](https://github.com/iranrenterdevelopment "iranrenterdevelopment (1 commits)")[![farshidrezaei](https://avatars.githubusercontent.com/u/16887867?v=4)](https://github.com/farshidrezaei "farshidrezaei (1 commits)")[![mohammad-fouladgar](https://avatars.githubusercontent.com/u/13538673?v=4)](https://github.com/mohammad-fouladgar "mohammad-fouladgar (1 commits)")

---

Tags

laravellaravel-farsi-validationlaravel-persian-validationpersianpersian-alphabetpersian-validationphpvalidationvalidation-farsivalidatorlaravelvalidatorvalidationlumennational codeJalalijalali\_dateiranpersianshamsiphp8postal-codefarsiIBANmobile validationlaravel-validationpersian textiranianpersian-validationbank-cardshebafarsi-validationcard-numberiranian-validationshamsi-datepersian-dateiranian-national-idiranian-mobilepersian-mobileiranian-ibaniranian-postalcompany-idfarsi-textpersian-alphabetpersian-numbersmodern-laravel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel

3893.6M1](/packages/axlon-laravel-postal-code-validation)[intervention/validation

Additional validation rules for the Laravel framework

6827.2M20](/packages/intervention-validation)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2462.4M7](/packages/laravel-validation-rules-credit-card)[proengsoft/laravel-jsvalidation

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

1.1k2.4M50](/packages/proengsoft-laravel-jsvalidation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

762649.9k18](/packages/wendelladriel-laravel-validated-dto)

PHPackages © 2026

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