rezahmady/smsir
Composer 安装命令:
composer require rezahmady/smsir
包简介
README 文档
README
This package makes it easy to send notifications using Smsir with Laravel 5.5+, 6.x, 7.x , 8.x and 9.x
Contents
Installation
composer require rezahmady/smsir
Setting up the Smsir service
First add these environment variables in your .env file:
SMSIR_API_KEY="xxxx"
SMSIR_SECRET_KEY="xxxx"
SMSIR_LINE_NUMBER="xxxx"
then add this method to your User model
public function routeNotificationForSmsir()
{
return $this->mobile;
}
Usage
sample notification class:
namespace App\Notifications\Sms;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Rezahmady\Smsir\SmsirChannel;
use Rezahmady\Smsir\SmsirMessage;
class VerificationCode extends Notification
{
use Queueable;
public $parameter;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($parameter)
{
$this->parameter = $parameter;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [SmsirChannel::class];
}
public function toSmsir($notifiable)
{
return (new SmsirMessage())
->setMethod('ultraFastSend')
->setTemplateId('47119')
->setParameters([
'VerificationCode' => $this->parameter
]);
}
}
sample trigger this notification :
return auth()->user()->notify(new VerificationCode('1234'));
Available Message methods
A list of all available options
setMethod
is require
->setMethod('METHOD_NAME')
smsir has two method for send sms :
1. ultraFastSend
require attributes is parameters (array) and templateId (string)
set them with this chain methods :
->setTemplateId('THEMPLATE_ID')
->setParameters([...]);
2. sendVerificationCode
require attributes is code (string)
set it with this chane method :
->setCode('YOUR_CODE')
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email ahmadireza15@gmail.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
Note: This package has been used to develop amirbagh75/smsir-php Thanks to Amirhossein Baghaie
统计信息
- 总下载量: 328
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-26