Download the PHP package asorasoft/chhankitek without Composer
On this page you can find all versions of the php package asorasoft/chhankitek. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asorasoft/chhankitek
More information about asorasoft/chhankitek
Files in asorasoft/chhankitek
Package chhankitek
Short Description Convert from AD (Anno Domini) to Lunar (Chhankitek) format.
License MIT
Homepage https://github.com/HELMAB/chhankitek
Informations about the package chhankitek
A PHP package to convert dates to Lunar (Chhankitek) format — works with or without Laravel. Learn more about Khmer calendar.
Documentation
For detailed documentation, please visit https://chhankitek.netlify.app
Installation
You can install the package via composer:
Usage
Timezone note:
->setTimezone('Asia/Phnom_Penh')ensures the correct Cambodian date is used when your server runs in a different timezone (e.g. UTC). Near midnight UTC, the calendar date differs from Cambodia's. You can omit it ifapp.timezoneinconfig/app.phpis already set toAsia/Phnom_Penh.
Available Methods
Alternatively, you can use the toLunarDate helper function:
Pure PHP Usage (without Laravel)
The package works in any PHP project — Laravel is not required. The only runtime dependency is nesbot/carbon.
Instantiate Chhankitek directly and read the lunar date from the formatKhmerDate property:
The toLunarDate() helper is also available outside Laravel:
Khmer Numerals
Convert Arabic numerals to their Khmer representation with the HasKhmerNumberConversion trait:
Caching
The package caches converted dates for one year (365 days) to minimize computational overhead for frequently accessed dates. The cache is swappable via the CacheRepository interface, so it works the same whether or not you use Laravel.
Default behavior
- Inside Laravel — automatically uses Laravel's cache system (
LaravelCache), so it respects whatever cache driver your application is configured with. No setup required. - Pure PHP — falls back to an in-memory cache (
ArrayCache) that de-duplicates lookups within a single request or script run.
Providing your own cache
Pass any implementation of Asorasoft\Chhankitek\Cache\CacheRepository as the second constructor argument:
Testing
The test suite is split into two groups — run them individually if needed:
Changelog
Please see CHANGELOG for more information about recent changes.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Support
If you like this package and want to support me, you can buy me a coffee ☕
Credits
- Mab Hel
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Authors and Acknowledgment
This library would not exist without the hard work of these people:
- Based on the algorithm by
Mr. Phylypo Tumfrom Khmer Calendar - Ported from momentkh by
ThyrithSorintoJava - Khmer New Year Time Calculation
- Ported from MetheaX/khmer-chhankitek-calendar by
MetheaXinto aLaravel Package