PHPackages                             alifattahi/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. [Localization &amp; i18n](/categories/localization)
4. /
5. alifattahi/jalali

ActiveLibrary[Localization &amp; i18n](/categories/localization)

alifattahi/jalali
=================

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in Laravel 4 applications, based on Jalali (Shamsi) DateTime class. This Package is based on a Laravel 3 bundle sallar/laravel-jdate by Sallar Kaboli.

35153[1 PRs](https://github.com/alifattahi/jalali/pulls)PHP

Since Mar 10Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

alifattahi/jalali
=================

[](#alifattahijalali)

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in Laravel 4 applications, based on Jalali (Shamsi) DateTime class. This Package is based on a Laravel 3 bundle [sallar/laravel-jdate](https://github.com/sallar/laravel-jdate) by [Sallar Kaboli](http://sallar.me).

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

[](#installation)

In the `require` key of `composer.json` file add the following

```
    "alifattahi/jalali": "dev-master"
```

Run the Composer update comand

```
$ composer update

```

In your `config/app.php` add `'Alifattahi\Jalali\JalaliServiceProvider'` to the end of the `$providers` array

```
    'providers' => array(

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        ...
        'Alifattahi\Jalali\JalaliServiceProvider',

    ),
```

Basic Usage
-----------

[](#basic-usage)

Examples
--------

[](#examples)

Some Examples (based on examples provided by Sallar)

```
// default timestamp is now
$date = jDate::forge();

// pass timestamps
$date = jDate::forge(1333857600);

// pass strings to make timestamps
$date = jDate::forge('last sunday');

// get the timestamp
$date = jDate::forge('last sunday')->time(); // 1333857600

// format the timestamp
$date = jDate::forge('last sunday')->format('%B %d، %Y'); // دی 02، 1391

// get a predefined format
$date = jDate::forge('last sunday')->format('datetime'); // 1391-10-02 00:00:00
$date = jDate::forge('last sunday')->format('date'); // 1391-10-02
$date = jDate::forge('last sunday')->format('time'); // 00:00:00

// amend the timestamp value, relative to existing value
$date = jDate::forge('2012-10-12')->reforge('+ 3 days')->format('date'); // 1391-07-24

// get relative 'ago' format
$date = jDate::forge('now - 10 minutes')->ago() // ۱۰ دقیقه پیش
```

Formatting
----------

[](#formatting)

For help in building your formats, checkout the [PHP strftime() docs](http://php.net/manual/en/function.strftime.php).

Notes
-----

[](#notes)

The class relies on `strtotime()` to make sense of your strings, and `strftime()` to make the format changes. Just always check the `time()` output to see if you get false timestamps... which means the class couldn't understand what you were telling it.

License
-------

[](#license)

- This bundle is created based on [Laravel-Date](https://github.com/swt83/laravel-date) by [Scott Travis](https://github.com/swt83) (MIT Licensed).
- [Jalali (Shamsi) DateTime](https://github.com/sallar/jDateTime) class included in the package is created by [Sallar Kaboli](http://sallar.me) and is released under the MIT License.
- This package was created by [Milad Rey](http://milad.io) and is released under the MIT License.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6eef09ad3494ccada88cff9e2bbda8f33ed8497b614152cfb9934b71cbda543?d=identicon)[ali\_fattahi](/maintainers/ali_fattahi)

---

Top Contributors

[![alifattahi](https://avatars.githubusercontent.com/u/1831394?v=4)](https://github.com/alifattahi "alifattahi (2 commits)")

### Embed Badge

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

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

###  Alternatives

[php-translation/translator

Translator services

25224.8k5](/packages/php-translation-translator)[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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