PHP code example of kch / smsapi-bundle

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

    

kch / smsapi-bundle example snippets


$smsFactory = $this->get('kch_sms_api.sms_factory.default');

try {
    $actionSend = $smsFactory->actionSend();

    $actionSend->setTo('600xxxxxx');
    $actionSend->setText('Hello World!!');
    $actionSend->setSender('Info'); //Pole nadawcy, lub typ wiadomości: 'ECO', '2Way'

    $response = $actionSend->execute();

    foreach ($response->getList() as $status) {
        echo $status->getNumber() . ' ' . $status->getPoints() . ' ' . $status->getStatus();
    }
} catch (SmsapiException $exception) {
    echo 'ERROR: ' . $exception->getMessage();
}