Download the PHP package silkyland/sawasdee without Composer
On this page you can find all versions of the php package silkyland/sawasdee. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sawasdee
Sawasdee
Sawasdee, A miscellaneous library for number, words translator to Thai reading style including with Thai currency, date and time, Thai unit and also included Thai SEO URL. Sawasdee comes with easy to use PHP style and powerful with documentation.
Contributors
What's Sawasdee can do?
Sawasdee can translate number to Thai words reading style comes with:
- Translate DateTime to Thai DateTime e.g. "08/16/2015" convert to "16 สิงหาคม 2515" or "๑๖ สิงหาคม ๒๕๕๘" or any format you need
- Translate Thai currency e.g. "121.25" convert to "หนึ่งร้อยยี่สิบเอ็ดบาทยี่สิบห้าสตางค์" or input "215" will convert to "สองร้อยสิบห้าบาทถ้วน"
- Translate Thai Unit e.g. "999.99" convert to "เก้าร้อยเก้าสิบเก้าจุดเก้าเก้า"
- Convert word to url style e.g. "Boostrap ครองแชมป์ css framework ที่ดีที่สุด 100%" to "Boostrap-ครองแชมป์-css-framwork-ที่ดีที่สุด-100-เปอร์เซนต์"
Require
- PHP Version 5.4 or above
Installation
Via composer
Simply add a dependency on silkyland/sawasdee to your project's composer.json file if you use Composer to manage dependencies of your project. You can add code below to your composer.json file.
Or you can use command-line to add silkyland\sawasdee package too by use this command.
Via Download
Download zip file and exact to any folder you need in your project.
Usage
Thai date and time
By using "toThaiDateTime()" function you can input parameter string $date_input, bool $format, bool $short_month, bool $thai_numberic and bool $buddhist_year:
Basic using it will product default format like "date|month|buddhist year| |hourนาฬิกา|minuteนาที|secondวินาที"
You can custom format with these words : %d (date), %m (month), %y (year), %h (hour), %i (minute), %s (second).
By default short term of Thai month is turn to "false" that mean it will appear month name in full term. If you need a short term you need to use "true" in third parameter like this :
If you need Thai alphabet numberic for output number just use "true" in the 4th parameter :
Because Thailand use buddhist year and Sawasdee turn to buddhist year by default, If you need to change, you can also use "false" for AD (Anno Domini) format :
Thai currency reading style
To convert number to reading style you need to input number such as "456", 12500021, or "15.25" and it will return Thai number reading style back. Sure! it also already include "บาท (Bath)" and "สตางค์ (Satang)" in words its return.
Thai unit reading style
In Thai language unit reading such as metre, kilometre, gram, kilogram, celsius etc. Are read different from Thai currency in decimal point. "readThaiUnit()" function is useful to read unit in Thai style.
Thai URL SEO Friendly
To convert words to url style you need to use toThaiUrl() function