elmage / textng-php
PHP的TextNg SMS API非官方封装器
v0.2.0
2020-08-20 01:56 UTC
Requires
- php: ^7.4
- guzzlehttp/guzzle: ^6.3
- psr/http-message: ^1.0
- psr/log: ^1.0
- squizlabs/php_codesniffer: ^3.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.0
- styleci/cli: ^0.6.2
- vimeo/psalm: ^3.11
This package is auto-updated.
Last update: 2024-09-20 11:32:07 UTC
README
这是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
可以取三个值之一:all
、dnd
或success
(如API文档中指定)
创建客户
$response = $client->createCustomer($customerName, $customerPhone, $categoryID);
$categoryID
是您为每个创建的链接生成的分类URL ID。(如API文档中指定)
删除客户
$response = $client->removeCustomer($customerPhone, $categoryID);
变更日志
有关最近变更的更多信息,请参阅变更日志。
测试
$ composer test
贡献
安全
如果您发现任何与安全相关的问题,请通过mails4mage@gmail.com或使用问题跟踪器发送电子邮件。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。