承接 wobblecode/sms-counter-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wobblecode/sms-counter-php

最新稳定版本:0.5.2

Composer 安装命令:

composer require wobblecode/sms-counter-php

包简介

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.

README 文档

README

Character counter for SMS Messages

Build Status SensioLabsInsight

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 😎) on messages larger than 70 chars the remaining value will actually be the remaining chars in last message part only, this is due to how those chars are encoded using two 16bit chars and max part length being an odd number (67)

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

统计信息

  • 总下载量: 24.58k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 39
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 39
  • Watchers: 5
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-18