dash8x/dhiraagu-sms

PHP SDK for Dhiraagu Bulk SMS Gateway

v0.4.0 2022-05-26 14:44 UTC

This package is auto-updated.

Last update: 2024-12-26 20:21:02 UTC


README

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

PHP SDK for Dhiraagu Bulk SMS Gateway

Installation

You can install dhiraagu-sms via composer or by downloading the source.

Via Composer:

composer require dash8x/dhiraagu-sms

Quickstart

Send an SMS

// Send an SMS using Dhiraagu Bulk SMS Gateway and PHP
<?php
$username = "XXXXXXX"; // The username that you received from Dhiraagu (usually same as your SMS sender name)
$password = "YYYYYY"; // Your Dhiraagu Bulk SMS Gateway password
$url = 'https://bulksms.dhiraagu.com.mv/partners/xmlMessage.jsp'; // The Dhiraagu API endpoint. Leave blank to use the default URL. 

$client = new \Dash8x\DhiraaguSms\DhiraaguSms($username, $password, $url);
$message = $client->send(
  '+9607777777', // Text this number, use an array to send to multiple numbers
  'Hello World!' // Your message
);

print $message->message_id;

Check SMS Delivery Status

To check the delivery status of an SMS, first you will need to obtain the message_key and message_id when you send the SMS.

// Check the delivery status of an SMS using Dhiraagu Bulk SMS Gateway and PHP
<?php
$username = "XXXXXXX"; // The username that you received from Dhiraagu (usually same as your SMS sender name)
$password = "YYYYYY"; // Your Dhiraagu Bulk SMS Gateway password

$client = new \Dash8x\DhiraaguSms\DhiraaguSms($username, $password);
$message = $client->send(
  '+9607777777', // Text this number, use an array to send to multiple numbers
  'Hello World!' // Your message
);

$delivery = $client->delivery(
  $message->message_id, // Message id
  $message->message_key // Message key
);

print $delivery->message_status_desc;

// Check the status for a particular recipient
$device = $delivery->getDevice('9607777777'); // Omit the + of the country code
print $device->status_desc;

Demo

A demo implementation of this package can be found here.

Credits

Disclaimer

This package is not in any way officially affiliated with Dhiraagu. The "Dhiraagu" name has been used under fair use.

License

This Dhiraagu Bulk SMS Gateway SDK is open-sourced software licensed under the MIT license