PHPackages                             aicrion/date-converter - 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. aicrion/date-converter

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

aicrion/date-converter
======================

High-performance PHP library for converting between Gregorian, Jalali (Persian) and Hijri (Islamic) calendars.

v1.0.0(1mo ago)26↓66.7%MITPHP &gt;=8.2

Since Jul 6Compare

[ Source](https://github.com/Aicrion/date-converter-php)[ Packagist](https://packagist.org/packages/aicrion/date-converter)[ Docs](https://github.com/aicrion/date-converter-php)[ RSS](/packages/aicrion-date-converter/feed)WikiDiscussions Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Aicrion Date Converter
======================

[](#aicrion-date-converter)

A high-performance, zero-dependency PHP 8.2+ library for converting dates between **Gregorian**, **Jalali (Persian/Shamsi)**, and **Hijri (Islamic/Qamari)** calendars.

[![PHP Version](https://camo.githubusercontent.com/63c146e4b472633934fb889ce28499b215beb5d41fbe6f52d05b6c320730a5e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d373737626234)](https://www.php.net/)[![License](https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565)](LICENSE.md)

📖 **[Full Documentation](https://aicrion.github.io/date-converter-php/)**

Why this library?
-----------------

[](#why-this-library)

- **Single pivot architecture** — every calendar converts to/from a Julian Day Number (JDN), so adding a new calendar never touches existing conversion logic.
- **Astronomically accurate Jalali algorithm** — uses the Birashk/Borkowski break-point algorithm (same base as `jalaali-js`), correct across an extremely wide year range, not a naive fixed 33-year approximation.
- **Modern PHP** — readonly classes, backed enums, strict types, first-class callable syntax, PHP 8.2+ only.
- **Zero runtime dependencies.**
- **Safe by design** — every conversion validates the source date and the resulting target bounds; `canConvert()` lets you check feasibility without exceptions.

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

[](#installation)

```
composer require aicrion/date-converter
```

Quick start
-----------

[](#quick-start)

```
use Aicrion\DateConverter\DateConverter;
use Aicrion\DateConverter\Enum\CalendarType;

$converter = new DateConverter();

$result = $converter->convert('1404-04-15', CalendarType::Jalali, CalendarType::Gregorian);

echo $result->format('Y-m-d');      // 2025-07-06
echo $result->format('j F Y');      // 6 July 2025
print_r($result->toArray());        // structured array output
```

Supported input formats
-----------------------

[](#supported-input-formats)

```
$converter->convert('1404-04-15', CalendarType::Jalali, CalendarType::Gregorian);
$converter->convert('1404/04/15', CalendarType::Jalali, CalendarType::Gregorian, 'Y/m/d');
$converter->convert([1404, 4, 15], CalendarType::Jalali, CalendarType::Gregorian);
$converter->convert(['year' => 1404, 'month' => 4, 'day' => 15], CalendarType::Jalali, CalendarType::Gregorian);
```

Checking feasibility
--------------------

[](#checking-feasibility)

```
if ($converter->canConvert('1404-12-30', CalendarType::Jalali, CalendarType::Gregorian)) {
    // safe to convert
} else {
    // invalid date (e.g. Esfand 30th only exists in leap years)
}
```

Today in any calendar
---------------------

[](#today-in-any-calendar)

```
$today = $converter->today(CalendarType::Jalali);
echo $today->format('Y/m/d');
```

Documentation
-------------

[](#documentation)

Full API reference, algorithm notes, and advanced usage examples are published at:

****

Testing
-------

[](#testing)

```
composer install
composer test
```

Benchmarks
----------

[](#benchmarks)

```
php benchmarks/run.php
```

---

📜 License
---------

[](#-license)

Created with ❤️ by Aicrion. Licensed under the [MIT License](LICENSE.md). Free to use, modify, and distribute!

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12207627?v=4)[Hadi Akbarzadeh](/maintainers/nabeghe)[@nabeghe](https://github.com/nabeghe)

---

Tags

converterdatecalendarJalalipersianshamsihijrigregorianislamic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aicrion-date-converter/health.svg)

```
[![Health](https://phpackages.com/badges/aicrion-date-converter/health.svg)](https://phpackages.com/packages/aicrion-date-converter)
```

###  Alternatives

[fisharebest/ext-calendar

Implementation of the Arabic (Hijri), French, Gregorian, Jewish, Julian and Persian (Jalali) calendars. Also provides a replacement for the PHP ext/calendar extension.

31529.1k11](/packages/fisharebest-ext-calendar)[mohamedsabil83/laravel-hijrian

Hijri-Gregorian date converter for Laravel

1322.7k](/packages/mohamedsabil83-laravel-hijrian)[p3ym4n/jdate

Date converter from Jalali to Georgian and vice versa. It has Carbon instance inside and it's Laravel friendly.

101.8k2](/packages/p3ym4n-jdate)

PHPackages © 2026

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