PHP code example of bongrun / sms

1. Go to this page and download the library: Download bongrun/sms 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/ */

    

bongrun / sms example snippets


/** @var SmsSimple $sms */
$sms = new SmsSimple($smsAccesses, SmsSites::VKONTAKTE);

$balance = $sms->getBalance(); 
if (!$balance) {
    throw new Exception('Нет денег на смс');
}

$number = $sms->getNumber();

$sms = new SmsApi($user->getSmsAccesses(), SmsSites::VKONTAKTE);
$number = $sms->getNumber();

.....
.....

$sms->code();
if ($sms->isError()) {
    throw new \Exception('Смс не было получино');
}
$vkReg->setCode(preg_replace("/[^0-9]/", '', $sms->getCode()));