Chhankitek
Convert Gregorian dates to the Khmer Lunar calendar with precision — built on traditional Cambodian astronomical algorithms. Works in any PHP project, with or without Laravel.
Simple and precise
Convert a date in a single line — via the Laravel trait, the global helper, or pure PHP.
// In Laravel — using the trait
use HasChhankitek;
$lunarDate = $this->chhankitek(
Carbon\CarbonImmutable::now()->setTimezone('Asia/Phnom_Penh')
);
echo $lunarDate->toString();
// ថ្ងៃច័ន្ទ ៤ រោច ខែបឋមាសាឍ ឆ្នាំឆ្លូវ ត្រីស័ក ពុទ្ធសករាជ ២៥៦៥
// Or the global helper
echo toLunarDate(Carbon\CarbonImmutable::now()->setTimezone('Asia/Phnom_Penh'));
// Pure PHP — no Laravel required
use Asorasoft\Chhankitek\Chhankitek;
echo (new Chhankitek(
Carbon\CarbonImmutable::now()->setTimezone('Asia/Phnom_Penh')
))->formatKhmerDate->toString();
Everything you need for Khmer calendar conversions
Accurate Conversions
Based on traditional Khmer astronomical algorithms by Mr. Phylypo Tum.
Swappable Caching
Results cached for 365 days; plug in your own cache or use the built-in one.
Framework Agnostic
Works in any PHP project — with optional Laravel integration (10–13).
Leap Year Support
Handles leap months (Adhikameas) and leap days automatically.
Simple API
Use via trait, global helper, or direct instantiation — your choice.
Zodiac & Era
Get animal year, era year, and Buddhist Era calculations.
Get started in seconds
The only runtime dependency is nesbot/carbon. Inside Laravel, the service provider registers automatically — no configuration needed.
composer require asorasoft/chhankitek
Choose the method that fits your workflow
Both deliver the same accurate Khmer lunar conversions.
Component-level control
For controllers, models, and services where you need granular access to each calendar component.
- — Retrieve day, month, zodiac, era, and year independently
- — Type-safe and IDE-friendly with full autocomplete
- — Clean object-oriented integration
Best for: API responses, complex date manipulation, custom displays.
use HasChhankitek;
$date = $this->chhankitek(
CarbonImmutable::now()
->setTimezone('Asia/Phnom_Penh')
);
// Access individual components
$dayOfWeek = $date->getDayOfWeek();
$lunarDay = $date->getLunarDay();
$lunarMonth = $date->getLunarMonth();
$zodiac = $date->getLunarZodiac();
$era = $date->getLunarEra();
$year = $date->getLunarYear();
// Or the complete formatted string
echo $date->toString();
// One-line conversion
$lunarDate = toLunarDate(
CarbonImmutable::now()
->setTimezone('Asia/Phnom_Penh')
);
// Display the formatted string
echo $lunarDate->toString();
// ថ្ងៃច័ន្ទ ៤ រោច ខែបឋមាសាឍ
// ឆ្នាំឆ្លូវ ត្រីស័ក ពុទ្ធសករាជ ២៥៦៥
// Use directly in Blade
{{ toLunarDate($date)->toString() }}
Quick & simple conversion
For Blade templates, views, and rapid prototyping. A single global call, no setup.
- — Zero configuration, available globally
- — Returns a complete formatted Khmer date string
- — Clean, readable syntax for templates
Best for: Blade templates, quick displays, emails, PDF generation.
Ready to explore more?
Advanced usage patterns, the full API reference, and detailed examples.
The Khmer ចន្ទគតិ system
For over a millennium, Cambodia has used a sophisticated lunisolar calendar that harmonizes the rhythms of the moon and sun — guiding everything from rice planting to sacred ceremonies.
Heritage & precision
The Khmer lunar calendar, known as ចន្ទគតិ (Chântôkôtĕ), represents centuries of astronomical observation and mathematical refinement by Cambodian scholars and monks.
This lunisolar system synchronizes two cycles: the lunar month (29–30 days) based on moon phases, and the solar year (~365.25 days) tracking Earth's orbit.
Why it matters
Traditional Cambodian life revolves around this calendar — determining planting seasons and celebrating បុណ្យភ្ជុំបិណ្ឌ (Pchum Ben), បុណ្យចូលឆ្នាំខ្មែរ (Khmer New Year), and countless cultural events.
Buddhist Era years
Counted from the parinirvana of Buddha (543 BCE) — 2025 CE equals BE 2568/2569. The transition occurs on Visakha Bochea, not January 1st.
Leap months (Adhikameas)
To keep lunar and solar years aligned, a 13th month is added roughly every 2–3 years, preventing seasonal drift.
Zodiac animal cycle
Each year maps to one of 12 animals — rat, ox, tiger, rabbit, dragon, snake, horse, goat, monkey, rooster, dog, pig.
Moon phases
Each month splits into កើត (waxing, days 1–15) and រោច (waning, days 1–14/15).