Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
chanthornsp committed Sep 1, 2023
1 parent a484969 commit 6ee7678
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,44 @@ use Chanthorn\CarbonKh\ToKhmerDate;

```

# Use Helper Function

```php
require_once __DIR__ . '/vendor/autoload.php';

echo khmerDate('2024-01-01')->format();
//ថ្ងៃច័ន្ទ ៥រោច ខែមិគសិរ ឆ្នាំថោះ បញ្ចស័ក ពុទ្ធសករាជ ២៥៦៧

print_r(khmerDate('2024-01-01')::khNewYear());

print_r(KhmerNewYearDate(2024));
// array:3 [
// "date" => Carbon\Carbon
// "days" => 4
// "dates" => array:4
// ]
```

# Usage with Laravel

```php
use Chanthorn\CarbonKh\ToKhmerDate;

$date = Carbon::parse('2023-01-01');
$khmerDate = new ToKhmerDate($date);

echo $khmerDate::format(); // ថ្ងៃអាទិត្យ ១០កើត ខែបុស្ស ឆ្នាំខាល ចត្វាស័ករាជ ២៥៦៦
echo $khmerDate::format('dN ថ្ងៃW ខែm ព.ស. b'); // ១០កើត ថ្ងៃអាទិត្យ ខែបុស្ស ព.ស. ២៥៦៦

print_r($khmerDate::khNewYear());
// array:3 [
// "date" => Carbon\Carbon
// "days" => 3
// "dates" => array:3
// ]

```

## Format

Check out format [here](https://github.com/ThyrithSor/momentkh#format)
Expand Down

0 comments on commit 6ee7678

Please sign in to comment.