Instasent - SMS Counter for PHP
Character counter for SMS Messages
Usage
use Instasent\SMSCounter\SMSCounter;
$smsCounter = new SMSCounter();
$smsCounter->count('some-string-to-be-counted');
$smsCounter->countWithShiftTables('some-string-to-be-counted');
which returns
stdClass Object
(
[encoding] => GSM_7BIT
[length] => 25
[per_message] => 160
[remaining] => 135
[messages] => 1
)
UTF16 notice
When using unicode chars over U+10000 (mainly emoticons
Sanitization
You can sanitize your text to be a valid strict GSM 03.38 charset
use Instasent\SMSCounter\SMSCounter;
$smsCounter = new SMSCounter();
$smsCounter->sanitizeToGSM('dadáó'); //return dadao
National Language Shift Tables
Starting release 8 of GSM 03.38 some additional charsets are allowed. This is the list of such National Language Shift Tables currently supported
Installation
sms-counter-php
is available via composer on packagist.
{
"require": {
"instasent/sms-counter-php": "^0.4"
}
}
License
SMS Counter (PHP) is released under the MIT License
Mentions
- Original idea : danxexe/sms-counter
- Fork Idea from: acpmasquerade/sms-counter-php