peterls / smsru
修改过的PHP类,用于与sms.ru服务API交互
1.0.1
2023-02-15 05:43 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.2
This package is auto-updated.
Last update: 2024-09-15 09:00:45 UTC
README
用于与sms.ru服务API交互的PHP类 sms.ru
安装
composer require peterls/smsru
将以下内容添加到您的文件 composer.json
使用
简单授权(使用api_id)
$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId));
增强授权(使用api_id、用户名和密码)
$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\LoginPasswordSecureAuth($login, $password, $apiId));
增强授权(使用用户名和密码)
$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\LoginPasswordAuth($login, $password));
发送短信
$sms1 = new \Zelenin\SmsRu\Entity\Sms($phone1, $text1); $sms1->translit = 1; $sms2 = new \Zelenin\SmsRu\Entity\Sms($phone2, $text2); $client->smsSend($sms1); $client->smsSend($sms2); $client->smsSend(new \Zelenin\SmsRu\Entity\SmsPool([$sms1, $sms2]));
短信状态
$send = $client->smsSend($sms); $smsId = $send->ids[0]; $client->smsStatus($smsId);
短信费用
$client->smsCost(new \Zelenin\SmsRu\Entity\Sms($phone, $text));
余额
$client->myBalance();
每日限额
$client->myLimit();
发送者
$client->mySenders();
检查用户名和密码的有效性
$client->authCheck();
将号码添加到黑名单
$client->stoplistAdd($phone, $text);
从黑名单中删除号码
$client->stoplistDel($phone);
获取黑名单号码
$client->stoplistGet();