PHP code example of thilanga / telstra-sms

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

    

thilanga / telstra-sms example snippets


$bundles = array(
    ....
     //SMS
     new ScayTrase\SmsDeliveryBundle\SmsDeliveryBundle(),
     new Thilanga\Telstra\SMSBundle\ThilangaTelstraSMSBundle(),

    ....
    );

sms_delivery:
    transport: sms_delivery.transport.telstra
    disable_delivery: false
    delivery_recipient: null

thilanga_telstra_sms:
    enabled: true
    sms_api_key: xxxxxxxxxxxxxxxxxxx
    sms_api_secret: yyyyyyyyyyyyyyyy


    use Thilanga\Telstra\SMSBundle\Message\TelstraSmsMessage;

    /**
     * @Route("/testsms", name="testsms")
     */
    public function sendSmsAction()
    {
        $message = new TelstraSmsMessage('0400001111', 'This is a test message.');

        $sender = $this->get('sms_delivery.sender');

        $result = $sender->send($message);

        if (isset($result->messageId)) {
            return new Response('Delivery :successful');
        } else {
            return new Response('Delivery :failed');
        }
    }