Skip to main content
πŸ•ŠοΈ αž€αž˜αŸ’αž–αž»αž‡αžΆαžαŸ’αžšαžΌαžœαž€αžΆαžšαžŸαž“αŸ’αžαž·αž—αžΆαž–
CAMBODIA NEEDS PEACE πŸ‡°πŸ‡­

αž™αžΎαž„αž‚αžΆαŸ†αž‘αŸ’αžšαžŠαž›αŸ‹αž‘αžΆαž αžΆαž“αžαŸ’αž˜αŸ‚αžšαž‘αžΆαŸ†αž„αž’αžŸαŸ‹αžŠαŸ‚αž›αž€αžΆαžšαž–αžΆαžšαž‘αžΉαž€αžŠαžΈαž‡αžΆαžαž· β€’ We stand with our brave soldiers defending our homeland

Laravel Package for Khmer Calendar

Chhankitek for Laravel

Convert Gregorian dates to Khmer Lunar calendar format with precision. Built with traditional astronomical algorithms.

PHP 8.2+
Modern PHP
Laravel 10+
Framework
MIT
Open Source

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!

Two Powerful Methods

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();
1 Trait Method

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

Best For:

API responses, complex date manipulation, custom calendar displays, and data transformations

OR
2 Helper Function

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

Best For:

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 Documentation
Traditional Khmer Astronomy

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 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

BE

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.

13

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.

Why Choose Chhankitek

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.