elmage/textng-php

PHP的TextNg SMS API非官方封装器

v0.2.0 2020-08-20 01:56 UTC

This package is auto-updated.

Last update: 2024-09-20 11:32:07 UTC


README

Latest Version on Packagist Latest Version on Packagist Software License Build Status Coverage Status

这是TextNg SMS API的非官方客户端库。我们提供一个直观、稳定的接口,以将TextNG SMS集成到您的PHP项目中。

安装

使用Composer安装库。如果您不熟悉Composer或通用依赖管理器,请阅读Composer文档

$ composer require elmage/textng-php

认证

API密钥

use Elmage\TextNg\Configuration;
use Elmage\TextNg\Client;

$configuration = new Configuration($apiKey, $senderName);
$client = Client::create($configuration);

使用

此内容并非旨在提供API的完整文档。如需更多详细信息,请参阅官方文档

获取单元余额

$response = $client->getBalance();

发送短信

$response = $client->sendSMS($route, $phoneNumbers, $message, $bypassCode, $optionalParamsArray);

发送OTP

// This method accepts only one phone number 
// and calls $client->sendSMS(..., [$phoneNumber], ...)
// passing the supplied phone number as the single element in an array

$response = $client->sendOTP($route, $phoneNumber, $message, $bypassCode, $optionalParamsArray);

获取投递报告

$response = $client->getDeliveryReport($reference, $req, $used_route);

$req可以取三个值之一:alldndsuccess(如API文档中指定)

创建客户

$response = $client->createCustomer($customerName, $customerPhone, $categoryID);

$categoryID是您为每个创建的链接生成的分类URL ID。(如API文档中指定)

删除客户

$response = $client->removeCustomer($customerPhone, $categoryID);

变更日志

有关最近变更的更多信息,请参阅变更日志

测试

$ composer test

贡献

请参阅贡献指南行为准则以获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过mails4mage@gmail.com或使用问题跟踪器发送电子邮件。

鸣谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件