um / sms-charset-detector
一个用于检测您的短信是否仅使用gsm字符集的小型库
v1.0.0
2021-01-10 17:59 UTC
Requires
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-11 02:23:34 UTC
README
使用gsm字符集检测sms字符集。
sms-charset-detector 帮助您检测短信内容是否仅包含gsm字符集符号。
安装
使用 Composer 安装包
> composer require um/sms-charset-detector
用法
简单用法
use Um\CharsetDetector\BasicCharsetDetector; $detector = new BasicCharsetDetector(); $message = 'Some message to be sent over sms'; $encoding = $detector->detectCharset($message); echo $encoding; // outputs either 'gsm' or 'ucs' // simple check if charset is 'gsm' $messageHasGsmCharset = $detector->isGsmCharset($message); var_dump($messageHasGsmCharset); // outputs either `true` or `false`