creattico/yeastar-socket-sms

yeastar设备短信类:允许您通过socket API发送短信

v1.0.6 2023-01-17 17:38 UTC

This package is auto-updated.

Last update: 2024-09-17 21:41:51 UTC


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