PHPackages                             halaei/jalali - 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. halaei/jalali

Abandoned → [opilo/farsi](/?search=opilo%2Ffarsi)ArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

halaei/jalali
=============

Jalali date validator for Laravel based on opilo/farsi

0.0.2(10y ago)124551MITPHPPHP &gt;=5.5

Since Dec 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/halaei/jalali)[ Packagist](https://packagist.org/packages/halaei/jalali)[ RSS](/packages/halaei-jalali/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Jalali Validator For Laravel 4.2 and Laravel 5
==============================================

[](#jalali-validator-for-laravel-42-and-laravel-5)

[![Build Status](https://camo.githubusercontent.com/fafa0f14189fb6cd2985586b3a0f34a41c0ceb0ffca8c2af5e279cf38746380b/68747470733a2f2f7472617669732d63692e6f72672f68616c6165692f6a616c616c692e737667)](https://travis-ci.org/halaei/jalali)[![Latest Stable Version](https://camo.githubusercontent.com/8577662194fc8e14969f2cf9919d18a498c745de637bf5b2a419fb114eecac39/68747470733a2f2f706f7365722e707567782e6f72672f68616c6165692f6a616c616c692f762f737461626c65)](https://packagist.org/packages/halaei/jalali)[![Total Downloads](https://camo.githubusercontent.com/39dd60cbb206ef779b797a0d8284aea71e56f812d30788d5402aa989f0309367/68747470733a2f2f706f7365722e707567782e6f72672f68616c6165692f6a616c616c692f646f776e6c6f616473)](https://packagist.org/packages/halaei/jalali)[![Latest Unstable Version](https://camo.githubusercontent.com/4d061a2b939b7489a6a4f030949d9e149a9c2340132da637c267f0c932f164b3/68747470733a2f2f706f7365722e707567782e6f72672f68616c6165692f6a616c616c692f762f756e737461626c65)](https://packagist.org/packages/halaei/jalali)[![License](https://camo.githubusercontent.com/da8e00ab280bf237624f96cf0d59a17558dfa5de4344db1b7883214e8e745279/68747470733a2f2f706f7365722e707567782e6f72672f68616c6165692f6a616c616c692f6c6963656e7365)](https://packagist.org/packages/halaei/jalali)

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

[](#installation)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
composer require halaei/jalali

```

### Step 2: Add the Service Provider

[](#step-2-add-the-service-provider)

Add the provider class to the array of providers in config/app.php file

```
	'providers' => [
	    ...
        Halaei\Jalali\Laravel\JalaliServiceProvider::class,
	]
```

### Step 3: Define the Error Messages

[](#step-3-define-the-error-messages)

You need to define error messages for `jalali`, `jalali_after`, and `jalali_before` rules in validation.php in lang folders. Samples to copy &amp; paste are provided under sample-lang directory of this package. For example, if your project uses Laravel 5 and your Farsi ranslation are under `resources/lang/fa` directory, copy these lines to `resources/lang/fa/validation.php`:

```
    'jalali'        => ':attribute وارد شده تاریخ شمسی معتبری طبق فرمت :format نیست (مثال معتبر: :fa-sample).',
    'jalali_after'  => ':attribute وارد شده باید یک تاریخ شمسی معتبر بعد از :date باشد.',
    'jalali_before' => ':attribute وارد شده باید یک تاریخ شمسی معتبر قبل از :date باشد.',
    ...
    //the rest of Farsi translations for validation rules.

    'attributes' => [
        'birth_date' => 'تاریخ تولد',
        ...
        //the rest of Farsi translations for attributes
    ],
    ...
```

Validation Rules
----------------

[](#validation-rules)

### jalali:Y/m/d

[](#jalaliymd)

Determines if an input is a valid Jalali date with the specified format. The default format is Y/m/d.

### jalali\_after:1380/1/1,Y/m/d

[](#jalali_after138011ymd)

Determines if an input is a valid Jalali date with the specified format and it is after a given date. The default format is Y/m/d and the default date is today.

### jalali\_before:1395-01-01,Y-m-d

[](#jalali_before1395-01-01y-m-d)

Determines if an input is a valid Jalali date with the specified format and it is before a given date. The default format is Y/m/d and the default date is today.

Examples
--------

[](#examples)

Thanks to Laravel 5, you may use the mentioned validation rules inside rule() function of your domain specific Request objects. If that is not an option, you can use the rules, just like any other Laravel rules with codes like the following:

```
    $v = Validator::make([
            'birth_date' => '1380/01/32'
        ],
        [
            'birth_date' => 'required|jalali|jalali_before:1381/01/01|jalali_after:1300/01/01,Y/m/d'
        ]);

    if ($v->fails()) {
        var_dump($v->messages()->toArray());
    }
```

The output of the code above will be:

```
array(1) {
  ["birth_date"]=>
  array(3) {
    [0]=>
    string(140) "تاریخ تولد وارد شده تاریخ شمسی معتبری طبق فرمت Y/m/d نیست (مثال معتبر: ۱۳۹۴/۹/۱۳)."
    [1]=>
    string(113) "تاریخ تولد وارد شده باید یک تاریخ شمسی معتبر قبل از 1381/01/01 باشد."
    [2]=>
    string(113) "تاریخ تولد وارد شده باید یک تاریخ شمسی معتبر بعد از 1300/01/01 باشد."
  }
}
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~10 days

Total

3

Last Release

3839d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dd52c170d3916b92b3cc7dd33f3cc813976395bb1e8c980130d9fdf7977d1eb?d=identicon)[halaei](/maintainers/halaei)

---

Top Contributors

[![halaei](https://avatars.githubusercontent.com/u/7089140?v=4)](https://github.com/halaei "halaei (10 commits)")

---

Tags

laravelJalalishamsipersian-calendarIranian Calendar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/halaei-jalali/health.svg)

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

###  Alternatives

[propaganistas/laravel-phone

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

3.0k38.3M139](/packages/propaganistas-laravel-phone)[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)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

761621.7k17](/packages/wendelladriel-laravel-validated-dto)[sunspikes/clamav-validator

Custom Laravel anti-virus validator for file uploads using ClamAV.

3712.0M5](/packages/sunspikes-clamav-validator)[prettus/laravel-validation

Laravel Validation Service

40611.2M52](/packages/prettus-laravel-validation)

PHPackages © 2026

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