PHPackages                             jalaali/jalaali-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jalaali/jalaali-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jalaali/jalaali-php
===================

PHP functions for converting Jalaali and Gregorian calendar systems to each other.

12731PHP

Since Jul 30Pushed 6y ago2 watchersCompare

[ Source](https://github.com/jalaali/jalaali-php)[ Packagist](https://packagist.org/packages/jalaali/jalaali-php)[ RSS](/packages/jalaali-jalaali-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Jalaali PHP
===========

[](#jalaali-php)

PHP implementation of [jalaali.js](https://github.com/jalaali/jalaali-js) which contains functions for converting Jalaali and Gregorian calendar systems to each other.

Jalaali calendar system has different names such as:

- Jalaali
- Khayyami
- Khorshidi
- Persian
- Shamsi

The base algorithm is a derived work of [Omar Khayyam](https://en.wikipedia.org/wiki/Omar_Khayy%C3%A1m), who *completed* the calendar system more than 900 years ago.

About
-----

[](#about)

Jalaali calendar is a solar calendar that was used in Persia, variants of which today are still in use in Iran as well as Afghanistan. [Read more](http://en.wikipedia.org/wiki/Jalali_calendar) or see [Calendar Converter](http://www.fourmilab.ch/documents/calendar/).

Calendar conversion is based on the algorithm provided by [Kazimierz M. Borkowski](http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm) and has a very good performance.

Install
-------

[](#install)

`composer require jalaali/jalaali-php`

API
---

[](#api)

Base Jalaali class is defined with 10 static methods inside Jalaali namespace, so there's no need for instantiation. For example, to convert Gregorian date to Jalaali use this code:

```
// PHP 3.0.x date to Jalaali :)
\Jalaali\Jalaali::toJalaali(2000, 10, 20)
```

There is a complete documentation page for this project on `docs/api` folder but the list of methods is as follows:

`toJalaali($gy, $gm, $gd)` : Converts a Gregorian date to Jalaali

`toGregorian($jy, $jm, $jd)` : Converts a Jalaali date to Gregorian

`isValidJalaaliDate($jy, $jm, $jd)` : Checks whether a Jalaali date is valid or not

`isLeapJalaaliYear($jy)` : Checks whether this is a leap year or not

`jalaaliMonthLength($jy, $jm)` : Number of days in a given month in Jalaali year

`jalaaliCalendar($jy)` : Base Algorithm

`j2d($jy, $jm, $jd)` : Converts a date of the Jalaali calendar to the Julian Day Number

`d2j($jdn)` : Converts the Julian Day Number to a date in the Jalaali calendar

`g2d($gy, $gm, $gd)` : Calculates the Julian Day number from Gregorian or Julian calendar dates

`d2g($jdn)` : Calculates Gregorian and Julian calendar dates from the Julian Day number

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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/cfaf6f2205ea05aa21aaeacc6e5e7058deb4ca7f3fcdb83a8023174a04000f92?d=identicon)[novid](/maintainers/novid)

---

Top Contributors

[![novid](https://avatars.githubusercontent.com/u/1545570?v=4)](https://github.com/novid "novid (11 commits)")

### Embed Badge

![Health badge](/badges/jalaali-jalaali-php/health.svg)

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

###  Alternatives

[d4h/finediff

PHP implementation of a Fine granularity Diff engine

151.5M1](/packages/d4h-finediff)[mrmysql/youtube-transcript

Retrieving transcripts for youtube videos.

20234.9k8](/packages/mrmysql-youtube-transcript)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)

PHPackages © 2026

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