balfour/php-smsportal

通过SmsPortal API发送短信的API客户端

1.0.1 2021-07-29 12:06 UTC

This package is auto-updated.

Last update: 2024-09-29 05:42:36 UTC


README

这是一个通过SmsPortal API发送短信的API客户端。

安装

composer require balfour/php-smsportal

用法

use Balfour\SmsPortal\SmsPortalClient;
use GuzzleHttp\Client;

$guzzle = new Client();
$client = new SmsPortalClient(
    $guzzle,
    null, // PSR-6 CacheItemPoolInterface
    '[your client id]',
    '[your secret]'
);

$resp = $client->sendMessage(
    '+27000000000',
    'This is a test message.'
);

如果您传递一个PSR-6 CacheItemPoolInterface的实现,则认证令牌将被缓存并用于后续请求。