creattico / yeastar-socket-sms
yeastar设备短信类:允许您通过socket API发送短信
v1.0.6
2023-01-17 17:38 UTC
Requires
- php: >=7.2
README
此库免费分发供使用。
使用composer安装
composer require creattico/yeastar-socket-sms
如何使用
初始化类,传递所有参数
$s = new SocketApi([ 'host' => 'domain.ext', 'port' => 1000, 'gateway_port' => 2, // the trunk port+1 'account' => 'username', 'password' => 'password', 'to' => '00111234567890', // the recipient number preceded by 4 digit country code 'message' => "The message content", 'debug' => true // optional: if you want to enable the debug ]);
发送短信
$s->sendSms();
关闭socket
$s->closeSocket();
调试
将debug
参数设置为true
,您可以访问到log
属性数组
print_r($s->log); // print log message array