multidialogo/phpgsm7codec

Utils to work with GSM7 codec

dev-main 2022-09-27 10:20 UTC

This package is auto-updated.

Last update: 2024-04-27 13:33:56 UTC


README

Utils to work with GSM7 codec

How to

Check if a given string contains non GSM7 characters

$isValid = CharsetAnalyzer::isValidGSM7String(
    'This is an invalid GSM7 string°.'
);

Get the number of non GSM7 characters in a given string

$extraCodecCharsCount = CharsetAnalyzer::countExtraCodecChars(
    'This string contains one° extra GSM7 character.'
);

Get the number of messages that would be generated by a given string

// 03.40 is the gsm protocol version
$gsmMessageCounter = new GsmMessageCounter('03.40');

$messageCount = $gsmMessageCounter->getMessagesCount(
    'This string will generate only one message.',
    true
)

How to run unit tests

Install dependencies including dev ones:

docker compose run --rm gsmcodec-php-composer composer exec composer install

Run phpunit test suite:

docker compose run --rm gsmcodec-php-composer composer exec vendor/bin/phpunit .