Skip to content
Asim Al-Twijry
Type to search
Active

ummulqura-calendar

A zero-dependency PHP library for exact Hijri ↔ Gregorian conversion on the official Umm al-Qura tables. Free and open source.

ummulqura-calendar

Tech

  • PHP

A PHP library for converting between Hijri and Gregorian dates on the official Umm al-Qura calendar. Every month start comes from the published tables, so a conversion is a table lookup, not an arithmetic estimate.

Highlights

  • 2,196 official months bundled, harvested from the official Umm al-Qura service.
  • Supported range: 1318 → 1500 AH (1900 → 2077 CE).
  • Date formatting with Arabic and English month and weekday names, in the style of PHP's date().
  • As published: for dates before 1420 AH, the library returns what the almanac of the time printed — the value Saudi national IDs recorded — alongside today's official reading.
  • Zero dependencies, no framework, PHP 8.1 or newer.

Example

use AsimNet\UmmulquraCalendar\UmmAlQura;

$eid = UmmAlQura::toHijri(new DateTimeImmutable('2026-03-20'));
$eid->toIsoString();     // "1447-10-01"
$eid->toArabicString();  // "1 شوال 1447هـ"

UmmAlQura::monthLength(1447, 9); // 30 — days in Ramadan 1447

Installation

composer config repositories.ummulqura-calendar vcs https://github.com/AsimNet/ummulqura-calendar
composer require asimnet/ummulqura-calendar

I built it as the foundation of the Hijri date picker for FilamentPHP.

The library in a terminal session, from converting to Hijri to formatting a date in Arabic
The library in a terminal session, from converting to Hijri to formatting a date in Arabic
Projects