eram / daynum
Immutable, zero-runtime-dependency multi-calendar library for PHP 8.1+. Gregorian, Jalali (Shamsi), and Hijri, differentially tested against ICU.
Requires
- php: >=8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.5
Suggests
- ext-intl: Only required for regenerating test oracle fixtures; not needed at runtime.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-08 12:52:14 UTC
README
Immutable multi-calendar dates for PHP 8.1+: Gregorian, Jalali, Hijri Umm al-Qura and civil Hijri. No Composer runtime dependencies or runtime ext-intl requirement.
Install
composer require eram/daynum:1.0.0-beta.4
These guides accompany v1.0.0-beta.4, a prerelease dated October 8, 2026. See release status and the changelog.
Quick start
<?php require 'vendor/autoload.php'; use Eram\Daynum\CivilDateTime; $d = CivilDateTime::fromGregorian(2026, 4, 8, 14, 30, 0, 'Asia/Tehran'); echo $d->gregorian()->format('Y-m-d H:i'), "\n"; echo $d->jalali()->withLocale('fa')->withDigits('persian')->format('l j F Y'), "\n"; echo $d->hijri()->format('Y/m/d'), "\n"; echo $d->hijriCivil()->format('Y/m/d'), "\n";
2026-04-08 14:30
چهارشنبه ۱۹ فروردین ۱۴۰۵
1447/10/20
1447/10/20
Calendar conversion preserves wall-clock time and the optional timezone label. Arithmetic returns CivilDateTime; select a view again to format. Use timestamps or native PHP for elapsed time and timezone conversion.
Documentation
- English guides · راهنمای فارسی
- Getting started · Recipes · API reference
- Migrating from morilog/jalali
- Contributing · Documentation maintenance · Security
License
MIT. See algorithm attribution for upstream sources.