eddieodira / messager
PHP BulkSMS API 实现用于 Hostpinnacle (肯尼亚)
v1.0.5
2024-05-08 12:27 UTC
Requires
- php: ^7.3|^8.1
README
这是肯尼亚 Hostpinnacle 的 PHP 批量短信的简单实现。此库包括发送单个或批量消息的功能。
Composer 安装
您可以通过 composer 安装此包
composer require eddieodira/messager
注册
要使用此库,您需要在 Hostpinnacle (https://www.hostpinnacle.co.ke) 上创建账户。他们将帮助您创建账户,您将从该账户获得以下凭据
- API 端点
- 用户 ID
- 密码
- API 密钥
- 发送者 ID
用法
发送单个消息
use Eddieodira\Messager\Sender; $configData = [ 'apiEndPoint' => 'xxxxxxxxxxxxxxxxxx', 'userId' => 'xxxxxxxxxxxxxxxxx', 'password' => 'xxxxxxxxxxxxxxxx', 'apiKey' => 'xxxxxxxxxxxxxxxxxxxx', 'senderId' => 'xxxxxxxxxxxxxxxxxxx', ]; $hostpinnacle = new Sender($configData); $hostpinnacle->setSendMethod('quick'); $hostpinnacle->setPhone('2547xxxxxxxx'); //You can only use mobile phone numbers in the format: 254721000000 or +254721000000 $hostpinnacle->setMessage('Hello, I am just testing this applications'); $hostpinnacle->sendMessage(); echo $hostpinnacle->getResponse();
向多个号码发送一条消息
use Eddieodira\Messager\Sender; $configData = [ 'apiEndPoint' => 'xxxxxxxxxxxxxxxxxx', 'userId' => 'xxxxxxxxxxxxxxxxx', 'password' => 'xxxxxxxxxxxxxxxx', 'apiKey' => 'xxxxxxxxxxxxxxxxxxxx', //You can leave this blank: 'apiKey' => '' if you have the other credentials 'senderId' => 'xxxxxxxxxxxxxxxxxxx', ]; $hostpinnacle = new Sender($configData); $hostpinnacle->setSendMethod('quick'); $hostpinnacle->setPhone('25472xxxxxxx, 25475xxxxxxx, 25476xxxxxxx'); //You can only use mobile phone numbers in the format: 254721000000 or +254721000000 $hostpinnacle->setMessage('Hello, I am just testing this applications'); $hostpinnacle->sendMessage(); echo $hostpinnacle->getResponse();
安排批量消息
为了发送计划中的消息,请确保调用方法 $hostpinnacle->setScheduleTime("2024-04-25 09:46:00");
,其中日期和时间作为参数
use Eddieodira\Messager\Sender; $configData = [ 'apiEndPoint' => 'xxxxxxxxxxxxxxxxxx', 'userId' => 'xxxxxxxxxxxxxxxxx', 'password' => 'xxxxxxxxxxxxxxxx', 'apiKey' => 'xxxxxxxxxxxxxxxxxxxx', //You can leave this blank: 'apiKey' => '' if you have the other credentials 'senderId' => 'xxxxxxxxxxxxxxxxxxx', ]; $hostpinnacle = new Sender($configData); $hostpinnacle->setSendMethod('quick'); $hostpinnacle->setPhone('25472xxxxxxx, 25475xxxxxxx, 25476xxxxxxx'); //You can only use mobile phone numbers in the format: 254721000000 or +254721000000 $hostpinnacle->setScheduleTime("2024-04-25 09:46:00"); $hostpinnacle->setMessage('Hello, I am just testing this applications'); $hostpinnacle->sendMessage(); echo $hostpinnacle->getResponse();
联系方式
如果您有任何问题或建议,请在 GitHub 上打开一个问题,或者您可以通过 +254715070754 或 odingoeddie@gmail.com 联系我。
许可证
我已经在这个存储库下发布了内容,采用MIT 许可证。