codeonweekends / usendit-php-sdk
uSendIt SMS网关的PHP SDK。
dev-master
2022-10-16 15:56 UTC
Requires
- guzzlehttp/guzzle: ^6.5
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-20 00:23:27 UTC
README
这是一个非官方的uSendIt SMS网关平台的PHP SDK。有关请求和响应参数的更多信息,请参阅官方文档此处。
安装
在您开始使用此SDK之前,请确保您已在uSendIt上拥有账户。如果没有,请创建一个。
使用Composer安装
最简单的方法是使用Composer。
composer require codeonweekends/usendit-php-sdk
下载ZIP文件或克隆
可选地,您可以直接将存储库下载到您的项目文件夹。只需点击此处。
或克隆存储库到您的项目文件夹。
git clone https://github.com/codeonweekends/usendit-php-sdk.git
如何安排短信
有两种方法可以发送短信。
sendMessage()
当您需要安排单个短信时,使用sendMessage()
方法。
安排单个短信
// Create a new SMS object $sms = new SMS(MSISDN, MOBILE_OPERATOR, MESSAGE); //Instantiate USendIt object and set the username and password of your uSendIt account. $uSendIt = new USendIt(); $uSendIt->setUsername('username'); $uSendIt->setPassword('password'); // Send the SMS $response = $uSendIt->sendMessage($sms);
sendMessage
方法返回一个ScheduleResult
对象。