um/sms-charset-detector

Small library for detecting whether your sms is using gsm charset only or not

v1.0.0 2021-01-10 17:59 UTC

This package is auto-updated.

Last update: 2024-09-11 02:23:34 UTC


README

GitHub Workflow Status GitHub release (latest SemVer)

Detecting sms charset using gsm charset.

sms-charset-detector helps you to detect whether your sms content contains gsm charset symbols only or not.

Installation

Install package with Composer:

> composer require um/sms-charset-detector

Usage

Simple usage:

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`