PHP code example of bankiru / sms-online

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

    

bankiru / sms-online example snippets




use Bankiru\Sms\SmsOnline\SmsOnline;
use Bankiru\Sms\SmsOnline\SmsOnlineTransport;
use ScayTrase\SmsDeliveryBundle\Service\ShortMessageInterface;

class MySms implements  ShortMessageInterface {
    /* ... */
}

$transport = new SmsOnlineTransport(
    new SmsOnline(new \GuzzleHttp\Client(), 'user', 'pass', 'https://service.qtelecom.ru/public/http/'),
    'friendly_man',
    new \Psr\Log\NullLogger(),
    '_transaction_prefix'
);
$transport->send(new MySms('1234567890', 'message body'));

class AppKernel extends Kernel {
    public function registerBundles() {
        return [
            //...
            new \ScayTrase\SmsDeliveryBundle\SmsDeliveryBundle();
            new \Bankiru\Sms\QtSms\QtSmsBundle(),
            //...
        ];
    }
}

class MyController extends Controller {
    public function sendAction() {
        $this->get('sms_delivery.sender')->spoolMessage(new MySms('1234567890', 'message body'));
    }
}