PHP code example of mysteryinfosolutions / yourbulksms

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

    

mysteryinfosolutions / yourbulksms example snippets


use MysteryInfo\YourBulkSms\YourBulkSmsClient;

$client = new YourBulkSmsClient([
    'authkey'                 => 'YOUR_AUTH_KEY',             // Required API Key
    'sender'                  => 'ABCDEF',                    // Default 6-char Sender ID (Optional)
    'route'                   => 2,                           // Default Route ID (Optional)
    'country'                 => 0,                           // Default Country Code prefix (Optional)
    'dlt_te_id'               => 'YOUR_DLT_TEMPLATE_ID',      // Default DLT template ID (Optional)
    'timeout'                 => 30.0,                        // HTTP Request timeout (Optional)
    'base_url'                => 'http://login.yourbulksms.com/api', // Base URL override (Optional)
    'default_response_format' => 'json',                      // Response format, 'json' or 'text' (Optional)
]);

$response = $client->send(
    ['919999999990', '919999999999'], 
    'Hello from Mystery Info Solutions'
);

if ($response->success) {
    echo "Sent! Gateway Code: " . $response->code; // e.g. 001
}

$response = $client->sendUnicode('919999999999', 'مرحبا بكم في حلول ميسري');

$scheduleTime = new \DateTime('2026-07-01 15:30:00');
$response = $client->sendScheduled('919999999999', 'This is a scheduled message.', $scheduleTime);

$response = $client->sendScheduledUnicode('919999999999', 'Scheduled Unicode ميسري', '2026-07-01 15:30:00');

$response = $client->sendInternational('447700900077', 'Hello international user!');

// Balance check for route type 1 (Promotional)
$balanceResponse = $client->getBalance(1); 
echo "Available Balance: " . $balanceResponse->balance;

$report = $client->getDeliveryReport('message_id_123456');
echo "Status: " . $report->message;

use MysteryInfo\YourBulkSms\Support\Route;

$response = $client->send('919999999999', 'Override Example', [
    'sender'    => 'OTPSDR',          // Override default sender ID
    'route'     => Route::OTP,        // Override default route ID
    'dlt_te_id' => 'DLT_TEMPLATE_99', // Override default DLT Template ID
]);

use MysteryInfo\YourBulkSms\Support\Route;

Route::PROMOTIONAL;       // 1
Route::TRANSACTIONAL;     // 2
Route::CBIS_TRANS;        // 3
Route::UNI_TRANS;         // 4
Route::TELSPIES_TRANS;    // 5
Route::OTP;               // 6

$reports = $client->parseWebhook($_GET);

$reports = $client->parseWebhook($_POST); // or $_REQUEST

foreach ($reports->items() as $item) {
    echo "Request ID: " . $item->requestId;
    echo "Recipient: " . $item->number;
    echo "Status Code: " . $item->status;
    echo "Description: " . $item->description;
    echo "Delivered At: " . $item->date; // Y-m-d H:i:s or date string
}

   use MysteryInfo\YourBulkSms\Laravel\Facades\YourBulkSms;

   $response = YourBulkSms::send('919999999999', 'Hello from Laravel!');
   

use MysteryInfo\YourBulkSms\YourBulkSmsClient;

$client = new YourBulkSmsClient([
    'authkey' => 'YOUR_AUTH_KEY',
    'sender'  => 'SENDER_ID'
]);

$response = $client->send('919999999999', 'Hello from CodeIgniter!');
bash
   php artisan vendor:publish --tag="yourbulksms-config"
   
bash
vendor/bin/phpunit tests/YourBulkSmsClientTest.php