dash8x/dhiraagu-sms

Dhiraagu 大量短信网关的 PHP SDK

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

This package is auto-updated.

Last update: 2024-09-26 19:37:31 UTC


README

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

Dhiraagu 大量短信网关的 PHP SDK

安装

您可以通过 composer 安装 dhiraagu-sms 或下载源代码。

通过 Composer

composer require dash8x/dhiraagu-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;

检查短信投递状态

要检查短信的投递状态,您首先需要在发送短信时获取 message_keymessage_id

// 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;

演示

此包的演示实现可以在 此处 找到。

致谢

免责声明

此包与 Dhiraagu 官方无任何官方关联。已根据公平使用原则使用 "Dhiraagu" 名称。

许可证

Dhiraagu 大量短信网关 SDK 是开源软件,许可协议为 MIT 许可协议