Chhankitek for Laravel
Convert Gregorian dates to Khmer Lunar calendar format with precision. Built with traditional astronomical algorithms.
Simple and Powerful
Convert dates in just one line of code
// Using the trait
use HasChhankitek;
$lunarDate = $this->chhankiteck(
Carbon\CarbonImmutable::now()->setTimezone('Asia/Phnom_Penh')
);
echo $lunarDate->toString();
// Output: ααααα
αααα α€ ααα
ααααααΆααΆα ααααΆαααααΌα ααααΈααα αα»αααααααΆα α’α₯α¦α₯
// Or use the helper function
echo toLunarDate(Carbon\CarbonImmutable::now()->setTimezone('Asia/Phnom_Penh'));
Features
Everything you need for Khmer calendar conversions
Accurate Conversions
Based on traditional Khmer astronomical algorithms by Mr. Phylypo Tum
Built-in Caching
Results cached for 365 days for optimal performance
Laravel Integration
Seamlessly integrates with Laravel 10, 11, and 12
Leap Year Support
Handles leap months (Adhikameas) and leap days automatically
Simple API
Use via trait or global helper function - your choice
Zodiac & Era
Get animal year, era year, and Buddhist Era calculations
Installation
Get started in seconds
composer require asorasoft/chhankitek
The package will automatically register its service provider. No additional configuration needed!
Choose Your Approach
Pick the method that best fits your workflow β both deliver the same accurate Khmer lunar calendar conversions
use HasChhankitek;
$date = $this->chhankiteck(
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 get the complete formatted string
echo $date->toString();
Component-Level Control
Perfect for controllers, models, and services where you need granular access to individual calendar components. This approach gives you complete flexibility to format and manipulate each piece of the lunar date separately.
Granular Component Access
Retrieve day, month, zodiac, era, and year independently for custom formatting
Type-Safe & IDE-Friendly
Full IDE autocomplete support with proper type hints and documentation
Clean Object-Oriented Design
Integrate seamlessly with your Laravel application architecture
API responses, complex date manipulation, custom calendar displays, and data transformations
Quick & Simple Conversion
Ideal for Blade templates, views, and rapid prototyping. Get a beautifully formatted Khmer lunar date string instantly with a single function call β no setup required.
Zero Configuration
Available globally throughout your application β just call and use
Instant Formatted Output
Returns a complete, properly formatted Khmer date string ready to display
Perfect for Views
Clean, readable syntax ideal for Blade templates and frontend display
Blade templates, quick displays, email templates, PDF generation, and rapid development
// One-line conversion
$lunarDate = toLunarDate(
CarbonImmutable::now()
->setTimezone('Asia/Phnom_Penh')
);
// Display the formatted string
echo $lunarDate->toString();
// Output example:
// ααααα
αααα α€ ααα
ααααααΆααΆα
// ααααΆαααααΌα ααααΈααα
// αα»αααααααΆα α’α₯α¦α₯
// Use directly in Blade
{{ toLunarDate($date)->toString() }}
Ready to explore more?
Check out our comprehensive documentation for advanced usage patterns, API reference, and detailed examples
View Full DocumentationThe 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 observations and mathematical refinement by Cambodian scholars and monks.
This lunisolar system masterfully synchronizes two celestial cycles: the lunar month (29-30 days) based on moon phases, and the solar year (approximately 365.25 days) tracking Earth's orbit around the sun.
Why It Matters
Traditional Cambodian life revolves around this calendarβdetermining planting seasons, celebrating αα»ααααααα»ααα·ααα (Pchum Ben), αα»αααα αΌαααααΆαααααα (Khmer New Year), and countless other cultural events.
Calendar Components
Buddhist Era Years
Counted from the parinirvana of Buddha (543 BCE), making 2025 CE equivalent to BE 2568/2569. The transition happens on Visakha Bochea day, not January 1st.
Leap Months (Adhikameas)
To keep lunar and solar years aligned, a 13th month is added approximately every 2-3 years based on complex astronomical calculations. This prevents seasons from drifting over time.
Zodiac Animal Cycle
Each year is associated with one of 12 animals (rat, ox, tiger, rabbit, dragon, snake, horse, goat, monkey, rooster, dog, pig) in a repeating cycle.
Moon Phases
Each month splits into ααΎα (waxing, days 1-15) and ααα (waning, days 1-14/15), marking the moon's journey from new to full and back.
Precision Meets Tradition
Chhankitek faithfully implements traditional Khmer astronomical algorithms, preserving centuries of mathematical and celestial knowledge in modern PHP code. Every conversion accounts for complex leap year calculations, Buddhist Era year transitions, moon phase cycles, and zodiac animal yearsβdelivering culturally accurate results your applications can depend on.