PHPackages                             roukmoute/polyfill-calendar - 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. roukmoute/polyfill-calendar

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

roukmoute/polyfill-calendar
===========================

PHP Polyfill for the Calendar extension

v1.0.0(5mo ago)535.2k↓40.7%2MITPHPPHP &gt;=8.0CI passing

Since Feb 6Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/roukmoute/polyfill-calendar)[ Packagist](https://packagist.org/packages/roukmoute/polyfill-calendar)[ RSS](/packages/roukmoute-polyfill-calendar/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (8)Versions (14)Used By (0)

Calendar Polyfill
=================

[](#calendar-polyfill)

[![Tests](https://github.com/roukmoute/polyfill-calendar/workflows/Tests/badge.svg)](https://github.com/roukmoute/polyfill-calendar/actions)[![License](https://camo.githubusercontent.com/289b30f11c3f8d645c48aa60bfd03660f4d3d650cfdd29d1a38180eb8299e543/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f756b6d6f7574652f706f6c7966696c6c2d63616c656e646172)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/8104d4556b1ee543acdd89e94c7a91dd61dccb8e63abb620d9d9f08f5efdd664/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f756b6d6f7574652f706f6c7966696c6c2d63616c656e646172)](composer.json)

A PHP polyfill for the [calendar extension](https://www.php.net/manual/en/book.calendar.php).

This library provides a pure PHP implementation of all calendar extension functions, allowing you to use calendar functionality without requiring the calendar extension to be installed.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher

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

[](#installation)

```
composer require roukmoute/polyfill-calendar
```

Supported Calendars
-------------------

[](#supported-calendars)

ConstantCalendar`CAL_GREGORIAN`Gregorian Calendar`CAL_JULIAN`Julian Calendar`CAL_JEWISH`Jewish Calendar`CAL_FRENCH`French Republican CalendarAvailable Functions
-------------------

[](#available-functions)

### Calendar Conversion

[](#calendar-conversion)

FunctionDescription[`cal_to_jd`](https://www.php.net/manual/en/function.cal-to-jd.php)Converts from a supported calendar to Julian Day Count[`cal_from_jd`](https://www.php.net/manual/en/function.cal-from-jd.php)Converts from Julian Day Count to a supported calendar[`cal_days_in_month`](https://www.php.net/manual/en/function.cal-days-in-month.php)Return the number of days in a month for a given year and calendar[`cal_info`](https://www.php.net/manual/en/function.cal-info.php)Returns information about a particular calendar### Gregorian Calendar

[](#gregorian-calendar)

FunctionDescription[`gregoriantojd`](https://www.php.net/manual/en/function.gregoriantojd.php)Converts a Gregorian date to Julian Day Count[`jdtogregorian`](https://www.php.net/manual/en/function.jdtogregorian.php)Converts Julian Day Count to Gregorian date### Julian Calendar

[](#julian-calendar)

FunctionDescription[`juliantojd`](https://www.php.net/manual/en/function.juliantojd.php)Converts a Julian Calendar date to Julian Day Count[`jdtojulian`](https://www.php.net/manual/en/function.jdtojulian.php)Converts a Julian Day Count to Julian Calendar Date### Jewish Calendar

[](#jewish-calendar)

FunctionDescription[`jewishtojd`](https://www.php.net/manual/en/function.jewishtojd.php)Converts a date in the Jewish Calendar to Julian Day Count[`jdtojewish`](https://www.php.net/manual/en/function.jdtojewish.php)Converts a Julian Day Count to the Jewish Calendar### French Republican Calendar

[](#french-republican-calendar)

FunctionDescription[`frenchtojd`](https://www.php.net/manual/en/function.frenchtojd.php)Converts a date from the French Republican Calendar to a Julian Day Count[`jdtofrench`](https://www.php.net/manual/en/function.jdtofrench.php)Converts a Julian Day Count to French Republican Calendar Date### Easter Functions

[](#easter-functions)

FunctionDescription[`easter_date`](https://www.php.net/manual/en/function.easter-date.php)Get Unix timestamp for midnight on Easter of a given year[`easter_days`](https://www.php.net/manual/en/function.easter-days.php)Get number of days after March 21 on which Easter falls for a given year### Unix Timestamp Conversion

[](#unix-timestamp-conversion)

FunctionDescription[`unixtojd`](https://www.php.net/manual/en/function.unixtojd.php)Convert Unix timestamp to Julian Day[`jdtounix`](https://www.php.net/manual/en/function.jdtounix.php)Convert Julian Day to Unix timestamp### Utility Functions

[](#utility-functions)

FunctionDescription[`jddayofweek`](https://www.php.net/manual/en/function.jddayofweek.php)Returns the day of the week for a Julian Day[`jdmonthname`](https://www.php.net/manual/en/function.jdmonthname.php)Returns a month nameUsage Examples
--------------

[](#usage-examples)

### Converting between calendars

[](#converting-between-calendars)

```
// Gregorian to Julian Day Count
$jd = gregoriantojd(12, 25, 2024); // December 25, 2024

// Julian Day Count to Gregorian
$date = jdtogregorian($jd); // "12/25/2024"

// Convert to Jewish calendar
$jewish = jdtojewish($jd); // "10/23/5785"
```

### Getting Easter date

[](#getting-easter-date)

```
// Get Easter Sunday timestamp for 2025
$easter = easter_date(2025);
echo date('Y-m-d', $easter); // 2025-04-20

// Get days after March 21
$days = easter_days(2025); // 30
```

### Calendar information

[](#calendar-information)

```
// Get info about all calendars
$info = cal_info();

// Get info about a specific calendar
$gregorian = cal_info(CAL_GREGORIAN);
print_r($gregorian['months']); // Array of month names
```

### Days in a month

[](#days-in-a-month)

```
// February 2024 (leap year)
$days = cal_days_in_month(CAL_GREGORIAN, 2, 2024); // 29

// February 2023 (not a leap year)
$days = cal_days_in_month(CAL_GREGORIAN, 2, 2023); // 28
```

Available Constants
-------------------

[](#available-constants)

### Calendar Types

[](#calendar-types)

- `CAL_GREGORIAN`, `CAL_JULIAN`, `CAL_JEWISH`, `CAL_FRENCH`, `CAL_NUM_CALS`

### Day of Week Modes

[](#day-of-week-modes)

- `CAL_DOW_DAYNO`, `CAL_DOW_SHORT`, `CAL_DOW_LONG`

### Month Name Modes

[](#month-name-modes)

- `CAL_MONTH_GREGORIAN_SHORT`, `CAL_MONTH_GREGORIAN_LONG`
- `CAL_MONTH_JULIAN_SHORT`, `CAL_MONTH_JULIAN_LONG`
- `CAL_MONTH_JEWISH`, `CAL_MONTH_FRENCH`

### Easter Calculation Modes

[](#easter-calculation-modes)

- `CAL_EASTER_DEFAULT`, `CAL_EASTER_ROMAN`
- `CAL_EASTER_ALWAYS_GREGORIAN`, `CAL_EASTER_ALWAYS_JULIAN`

### Jewish Calendar Formatting

[](#jewish-calendar-formatting)

- `CAL_JEWISH_ADD_ALAFIM_GERESH`, `CAL_JEWISH_ADD_ALAFIM`, `CAL_JEWISH_ADD_GERESHAYIM`

License
-------

[](#license)

This library is released under the [MIT license](LICENSE).

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance72

Regular maintenance activity

Popularity36

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 70.4% 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.

###  Release Activity

Cadence

Every ~241 days

Recently: every ~314 days

Total

10

Last Release

157d ago

Major Versions

v0.7.0 → v1.0.02026-01-17

PHP version history (4 changes)v0.1PHP ^7.1

v0.3PHP ^7.1 || ^8.0

v0.6.0PHP ^8.0

v1.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a864b67689c18f73803e34b6c4e269ab08395067ad635e1382ed96cc76f596a0?d=identicon)[roukmoute](/maintainers/roukmoute)

---

Top Contributors

[![roukmoute](https://avatars.githubusercontent.com/u/2140469?v=4)](https://github.com/roukmoute "roukmoute (50 commits)")[![kylekatarnls](https://avatars.githubusercontent.com/u/5966783?v=4)](https://github.com/kylekatarnls "kylekatarnls (21 commits)")

---

Tags

compatibilityportablepolyfillcalendar

###  Code Quality

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/roukmoute-polyfill-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/roukmoute-polyfill-calendar/health.svg)](https://phpackages.com/packages/roukmoute-polyfill-calendar)
```

###  Alternatives

[symfony/polyfill-mbstring

Symfony polyfill for the Mbstring extension

7.8k1.2B687](/packages/symfony-polyfill-mbstring)[symfony/polyfill-ctype

Symfony polyfill for ctype functions

4.0k1.0B178](/packages/symfony-polyfill-ctype)[symfony/polyfill-php72

Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions

4.7k684.0M35](/packages/symfony-polyfill-php72)[symfony/polyfill-intl-idn

Symfony polyfill for intl's idn\_to\_ascii and idn\_to\_utf8 functions

3.4k806.5M131](/packages/symfony-polyfill-intl-idn)[symfony/polyfill-intl-normalizer

Symfony polyfill for intl's Normalizer class and related functions

2.1k866.4M60](/packages/symfony-polyfill-intl-normalizer)[symfony/polyfill-php73

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

2.4k595.3M79](/packages/symfony-polyfill-php73)

PHPackages © 2026

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