smsjuice/http-api-wrapper

SMJuice HTTP API 的 PHP 文本消息封装器 >=5.3

1.0.0 2016-08-31 20:11 UTC

This package is not auto-updated.

Last update: 2024-09-22 10:11:34 UTC


README

SMSJuice HTTP API PHP Wrapper 提供了一种连接 SMSJuice HTTP API 服务器的简便方法。v1.0.0 版本的主要功能包括:

  • 向单个/多个联系人发送消息
  • 向您的 SMSJuice 账户中的单个/多个群组发送消息
  • 检查特定消息的报告
  • 检查账户余额和/或剩余短信余额
  • 向您的 SMSJuice 账户添加新的群组以及联系人
  • 向您的 SMSJuice 账户中现有的群组添加新的联系人(如有需要,可添加姓名)
  • 获取您的 SMSJuice 账户中所有群组的列表
  • 获取您的 SMSJuice 账户中特定群组的所有联系人列表
  • 删除您的 SMSJuice 账户中的群组(包括其中的所有联系人)
  • 从您的 SMSJuice 账户中的群组删除联系人

安装

1. Composer(推荐方式)

您可以使用 Composer 安装 SMSJuice HTTP API Wrapper。Composer 是 PHP 的依赖管理工具。它允许您声明项目所依赖的库,并且它会为您管理(安装/更新)它们。要安装 Composer,请遵循 https://getcomposer.org.cn/doc/00-intro.md 上的说明。

安装 Composer 后,在您的命令行/shell 中使用以下命令安装 SMSJuice HTTP API Wrapper。

$ composer require smsjuice/http-api-wrapper

...现在您可以继续了!

2. 下载 Zip 文件

https://www.smsjuice.com/text-messaging-api 下载 Zip 文件,并将其手动放入项目代码可访问的文件夹中。

用法

当您使用 composer 包结构时,以下是一个示例:


$m = new Message("key", "secret"); //new message object with your key and secret
 //FROM address        
$m->setSender("Restaurant");
 //Recipient Type. Options - 'groups' OR 'numbers'. Default:'numbers'
$m->setRecipientType("numbers");
$m->setRecipientList(array("447900239984", "447900392828")); //add contacts
$m->addToRecipientList("447900385486"); //add one contact
$m->setMessage("Hello world"); //content to send
//Send the message and get the response from the server
$result = TextMessagingService::sendMessage($m);
//JSON Result from the server
echo $result;

许可证

APACHE2