PHP code example of ilebora / borasms

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

    

ilebora / borasms example snippets



LEBORA\BoraSMS;

try {
    // Option 1: Using the constructor to load from environment variables
    $sms = new BoraSMS();

    // Option 2: Alternatively, set credentials using setters
    // $sms = (new BoraSMS())
    //     ->setApiKey('your_api_key')
    //     ->setUserID('your_user_id')
    //     ->setDisplayName('your_display_name');

    // Option3: Set the API version you are taregeting
    // $sms->setApiVersion('1.1');

    // Set other SMS properties
    $sms->setPhone('0113703323')
        ->setMessage('Hello, this is a test message!')
        // ->setOnSuccess('success_callback_url')
        // ->setOnFailure('failure_callback_url')
        ;

    // Send the SMS
    $response = $sms->sendSMS();

    // Handle the response
    echo "SMS Sent! Response: " . $response;

} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}