PHPackages                             dixonsatit/yii2-thai-year-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dixonsatit/yii2-thai-year-formatter

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

dixonsatit/yii2-thai-year-formatter
===================================

Convert Year to Thai Buddhist Era Year

0.9.8(2y ago)84.8k↓83.8%3[1 issues](https://github.com/dixonsatit/yii2-thai-year-formatter/issues)MITPHP

Since Jun 24Pushed 2y ago3 watchersCompare

[ Source](https://github.com/dixonsatit/yii2-thai-year-formatter)[ Packagist](https://packagist.org/packages/dixonsatit/yii2-thai-year-formatter)[ RSS](/packages/dixonsatit-yii2-thai-year-formatter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (11)Used By (0)

ThaiYearFormatter
=================

[](#thaiyearformatter)

แปลงค่าวันที่ เป็นปีภาษาไทย สำหรับ Yii framework (Yii 2)

> ThaiYearFormatter จำเป็นต้องเปิดการใช้งาน php extension intl ใน php.ini

เปิดไฟล์ php.ini แล้วเปิดใช้งาน ดังนี้

```
extension=php_intl.dll

[intl]
intl.default_locale =th_TH.UTF-8
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
;intl.error_level = E_WARNING

```

หากยังไม่มีให้ติดตั้งที่ server [ดูที่นี่](http://php.net/manual/en/intl.installation.php)

---

[ที่มา http://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes](http://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes)

การติดตั้ง
----------

[](#การติดตั้ง)

```
composer require --prefer-dist dixonsatit/yii2-thai-year-formatter "*"

```

หรือเพิ่มที่ ไฟล์ composer.json ในส่วน require

```
"dixonsatit/yii2-thai-year-formatter": "*"

```

หลังจากนั้น รันคำสั่ง `composer update`

การตั้งค่า
----------

[](#การตั้งค่า)

```
'language'=>'th_TH', // เปิดใช้งานภาษาไทย
'components' => [
	//...
    'thaiFormatter'=>[
        'class'=>'dixonsatit\thaiYearFormatter\ThaiYearFormatter',
    ],
]

```

การเรียกใช้งาน
--------------

[](#การเรียกใช้งาน)

เรียกใช้งานผ่าน component `thaiFormatter`

```
$time = time();
//$time = '2015-06-03 13:25:17';
echo Yii::$app->thaiFormatter->asDate($time, 'short')."";
echo Yii::$app->thaiFormatter->asDate($time, 'medium')."";
echo Yii::$app->thaiFormatter->asDate($time, 'long')."";
echo Yii::$app->thaiFormatter->asDate($time, 'full')."";

echo Yii::$app->thaiFormatter->asDateTime($time, 'short')."";
echo Yii::$app->thaiFormatter->asDateTime($time, 'medium')."";
echo Yii::$app->thaiFormatter->asDateTime($time, 'long')."";
echo Yii::$app->thaiFormatter->asDateTime($time, 'full')."";

echo Yii::$app->thaiFormatter->asDate($time, 'php:Y-m-d');
echo Yii::$app->thaiFormatter->asDateTime($time, 'php:Y-m-d H:i:s');
```

> ดู php date format ได้ที่นี่ [php date format](http://php.net/manual/en/function.date.php)

แสดงผล
------

[](#แสดงผล)

```
25/6/2558
25 มิ.ย. 2558
25 มิถุนายน 2558
วันอาทิตย์ที่ 25 มิถุนายน พ.ศ. 2558

25/6/2558, 9:57
25 มิ.ย. 2558, 9:57:18
25 มิถุนายน 2558, 9 นาฬิกา 57 นาที 18 วินาที GMT+07:00
วันอาทิตย์ที่ 25 มิถุนายน พ.ศ. 2558, 9 นาฬิกา 57 นาที 18 วินาที GMT+07:00

2015-06-24
2015-06-24 05:32:54

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~397 days

Recently: every ~792 days

Total

9

Last Release

854d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1027274?v=4)[Sathit Seethaphon](/maintainers/dixonsatit)[@dixonsatit](https://github.com/dixonsatit)

---

Top Contributors

[![dixonsatit](https://avatars.githubusercontent.com/u/1027274?v=4)](https://github.com/dixonsatit "dixonsatit (30 commits)")[![firdows](https://avatars.githubusercontent.com/u/18734077?v=4)](https://github.com/firdows "firdows (1 commits)")

---

Tags

yii2extension

### Embed Badge

![Health badge](/badges/dixonsatit-yii2-thai-year-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/dixonsatit-yii2-thai-year-formatter/health.svg)](https://phpackages.com/packages/dixonsatit-yii2-thai-year-formatter)
```

###  Alternatives

[vyants/yii2-daemon

Extension provides functionality for simple daemons creation and control

7760.4k](/packages/vyants-yii2-daemon)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1455.6k](/packages/dmstr-yii2-cookie-consent)[imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate.

2111.7k](/packages/imanilchaudhari-yii2-currency-converter)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1359.3k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
