wobblecode/sms-counter-php

This package is abandoned and no longer maintained. The author suggests using the instasent/sms-counter-php package instead.

SMS Counter PHP Class Library which detects encoding of an SMS message text, counts the characters as per the encoding and gives page limit information.

v0.4.2 2019-01-06 17:07 UTC

README

Character counter for SMS Messages

Build Status SensioLabsInsight

Usage

use Instasent\SMSCounter\SMSCounter;

$smsCounter = new SMSCounter();
$smsCounter->count('some-string-to-be-counted');

which returns

stdClass Object
(
[encoding]    => GSM_7BIT
[length]      => 25
[per_message] => 160
[remaining]   => 135
[messages]    => 1
)

You can sanitize your text to be a valid GSM 03.38 charset

use Instasent\SMSCounter\SMSCounter;

$smsCounter = new SMSCounter();
$smsCounter->sanitizeToGSM('dadáó'); //return dadao

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