PHP code example of phlib / sms-length

1. Go to this page and download the library: Download phlib/sms-length library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phlib / sms-length example snippets


$smsLength = new \Phlib\SmsLength\SmsLength('simple message');
$smsLength->validate(); // Throw exceptions for any validation failures
$smsLength->getSize(); // 14
$smsLength->getEncoding(); // '7-bit'
$smsLength->getMessageCount(); // 1
$smsLength->getUpperBreakpoint(); // 160

$smsLength = new \Phlib\SmsLength\SmsLength('message with • char requiring UCS-2');
$smsLength->validate(); // Throw exceptions for any validation failures
$smsLength->getSize(); // 35
$smsLength->getEncoding(); // 'ucs-2'
$smsLength->getMessageCount(); // 1
$smsLength->getUpperBreakpoint(); // 70