1. Go to this page and download the library: Download txtmsg/php-sdk 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/ */
txtmsg / php-sdk example snippets
use Txtmsg\PhpSdk\TxtmsgClient;
$client = new TxtmsgClient('your_api_key');
use Txtmsg\PhpSdk\TxtmsgClient;
use Txtmsg\PhpSdk\TxtmsgException;
$client = new TxtmsgClient('your_api_key');
try {
$response = $client->sendSMS([
'recipient' => '94771234567',
'sender_id' => 'TXTMSG',
'type' => 'plain',
'message' => 'Hello from TXTMSG.lk!',
]);
print_r($response);
} catch (TxtmsgException $e) {
echo 'Error: ' . $e->getMessage();
}