PHP code example of angstrom / pandora-sms

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

    

angstrom / pandora-sms example snippets


use Angstrom\PandoraSmsClient;

// Initialize the client (it will use credentials from .env)
$client = new PandoraSmsClient();

// Send SMS
$result = $client->sendSms(
    '0712345678',           // Phone number
    'Hello, World!',        // Message
    'YourSenderID',         // Sender ID (must be approved)
    'non_customised',       // Message type (non_customised or customised)
    'bulk'                  // Message category (bulk)
);

// Handle the response
if ($result['success']) {
    echo "Message sent successfully!\n";
    echo "Balance: " . $result['data']['balance'] . "\n";
    echo "SMS Cost: " . $result['data']['sms_cost'] . "\n";
} else {
    echo "Error: " . ($result['messages'][0] ?? $result['error_message']) . "\n";
}