zenepay/baht-text

reading money number to text in Thai baht

1.0.1 2024-06-05 11:14 UTC

This package is auto-updated.

Last update: 2025-01-31 00:36:14 UTC


README

Latest Stable Version Total Downloads License PHP Version Require

This package helps to translate baht amount to text. This should be useful for Invoice, Receipts in Thai baht

Installation

You can install the package via composer:

composer require zenepay/baht-text

Usage

Just simply calls the static function toText()

Support input of valid money format without symbol eg. 1,000,20.50

use Zenepay\BahtText\Baht;

$totalAmount = '2,010,025.25';
echo Baht::toText($totalAmount); // 'สองล้านหนึ่งหมื่นยี่สิบห้าบาทยี่สิบห้าสตางค์'

validate input format with

-10000.23 // true 1,000.23 // true -1,000.23 // true 1,0000,234.00 //false ู฿1,999,123.33 //false

Demo & Show Case

Credits

License

The MIT License (MIT)

Baht Text: ใช้เพื่อแปลงตัวเลขเงินบาท ให้เป็นข้อความอ่าน

เช่น '2,010,025.25' ==> 'สองล้านหนึ่งหมื่นยี่สิบห้าบาทยี่สิบห้าสตางค์'

การติดตั้ง

ติดตั้งผ่าน composer

composer require zenepay/baht-text

การใช้งาน

use Zenepay\BahtText\Baht;

$totalAmount = '2,010,025.25';
echo Baht::toText($totalAmount); // 'สองล้านหนึ่งหมื่นยี่สิบห้าบาทยี่สิบห้าสตางค์'

รองรับค่า input ที่เป็นจำนวนเงินที่ถูกต้อง มีคอมม่าหรือไม่มีก็ได้ ได้ทั้ง ติดลบและบวก

ดูตัวอย่างในบิล

Credits

License

The MIT License (MIT)