slayerz/triosms

使用 trio-mobile.com 的 API 在 Laravel 4 中发送短信

v1.0.3 2015-06-16 07:42 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:45:37 UTC


README

#Trio SMS

Latest Stable Version Total Downloads Latest Unstable Version License

介绍

使用来自 trio-mobile.com 的 API 在 Laravel 4 中发送短信

安装

使用 composer 安装此包

composer require slayerz/triosms

更新 composer 后,将 ServiceProvider 添加到 app/config/app.php 中的 providers 数组

'Slayerz\Triosms\TriosmsServiceProvider',

您可以通过发布此包来为该包配置自己的配置

php artisan config:publish slayerz/triosms

发布后,您可以在 app/config/packages/slayerz/triosms/config.php 中修改配置

'url'	=> 'API-URL-ADDRESS',
'token' => 'API-TOKEN',
'mode'	=> 'ACCOUNT-WITH-CREDIT'

您必须配置您的账户的默认发送模式。
默认发送模式设置为 shortcode

Trio SMS 可用模式

'shortcode' (send SMS using 5 digits number to international)
'longcode'  (send SMS using 10 digits number within Malaysia)

用法

函数 send( )
SMS::send($recipient, $message, $mode = '', $format = '');
  • $recipient: 收件人手机号码
  • $message: 要发送的消息(ASCII 160个字符,UNICODE 70个字符)
  • $mode: 从该账户发送短信(默认:shortcode
  • $format: 内容类型,1:ASCII 或 4:UNICODE(默认:1
函数 balance( )
SMS::balance($mode = '');
  • $mode: 您希望检查余额的账户(默认:shortcode

示例

发送短信
public function sendSMS()
{
	return SMS::send('60123456789', '160 chars for ASCII & 70 chars for UNICODE');
}

成功的消息应输出正值

CP22051400000001
检查信用余额
public function balanceCheck()
{
	return SMS::balance();
}

成功的检查应输出正整数值

1987

许可

Trio SMS 是开源软件,根据 MIT 许可证 许可