Download the PHP package softcreatr/polyfill-calendar without Composer
On this page you can find all versions of the php package softcreatr/polyfill-calendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download softcreatr/polyfill-calendar
More information about softcreatr/polyfill-calendar
Files in softcreatr/polyfill-calendar
Package polyfill-calendar
Short Description PHP Polyfill for the Calendar extension
License MIT
Informations about the package polyfill-calendar
polyfill-calendar
A precision-grade polyfill for PHP's ext/calendar. Built from php-src sources
and tuned for behavioral parity across PHP 8.1 - 8.5.
This is a maintained fork of roukmoute/polyfill-calendar that focuses on
complete feature coverage, strict compatibility, and predictable runtime
behavior. The public namespace remains Roukmoute\Polyfill\Calendar to
preserve drop-in compatibility.
Why this exists
- Full
ext/calendarfunction surface for PHP 8.1 - 8.5. - php-src aligned logic, including validation, overflow guards, and edge cases.
- Drop-in: functions are defined only when the extension is missing.
- Deterministic timezone resolution that mirrors the extension.
- Strict types and comprehensive tests.
Installation
Usage
Global functions (drop-in)
The Composer autoloader registers the polyfill functions when ext/calendar
is not available.
Class API
You can call the internal conversion classes directly when you want explicit control over the implementation.
Deterministic timezone behavior
easter_date() and unixtojd() resolve the system timezone the same way as
ext/calendar (TZ environment, /etc/timezone, /etc/localtime, PHP default).
If you need deterministic results in tests, set TZ explicitly:
Supported functions
cal_days_in_monthcal_from_jdcal_infocal_to_jdeaster_dateeaster_daysfrenchtojdgregoriantojdjddayofweekjdmonthnamejdtofrenchjdtogregorianjdtojewishjdtojulianjdtounixjewishtojdjuliantojdunixtojd
Compatibility
- PHP 8.1 - 8.5 only. PHP 7 support is intentionally dropped.
- If
ext/calendaris installed, native functions are used instead.
Testing
The test suite is designed for parity with php-src and targets full code coverage with Xdebug.
Credits
Based on roukmoute/polyfill-calendar and the ext/calendar sources in
php-src.
License
This library is released under the MIT license.