w3-devmaster/laravel-notibot
最新稳定版本:1.0.0
Composer 安装命令:
composer require w3-devmaster/laravel-notibot
包简介
API package for laravel framework
README 文档
README
Installation
Install with composer :
composer require w3-devmaster/laravel-notibot
Publish package config file :
php artisan vendor:publish --provider="W3Devmaster\Notibot\NotibotServiceProvider"
Add below to .env file :
ALERT_UUID=<your uuid from notibot services> ALERT_TOKEN=<your secret token from notibot services>
Basic Use
Email Alert (send now) :
use W3Devmaster\Notibot\Sender\Email; public function email() { $email = new Email(); $send = $email ->to('to-email@domain.com') ->subject('test') ->sender('sender-email@domain.com') ->content([ 'title' => 'Email Title', 'message' => 'Email Message', 'footer' => 'Email Footer', ]) ->exec(); return $send; }
Line notify (send now) :
use W3Devmaster\Notibot\Sender\LineNotify; public function line() { $line = new LineNotify(); $send = $line->to('<your line notify token>') ->message('test message') ->delay(true) ->delayTime('2023-11-10 15:00') ->exec(); return $send; }
Advanced Use (Transaction for alert)
Create transaction :
use W3Devmaster\Notibot\Notibot; use W3Devmaster\Notibot\Sender\Email; use W3Devmaster\Notibot\Sender\LineNotify; public function create() { $email = new Email(); $email->to('to-email@domain.com') ->subject('test') ->sender('sender-email@domain.com') ->content([ 'title' => 'Email Title', 'message' => 'Email Message', 'footer' => 'Email Footer', ]); $line = new LineNotify(); $line->to('<your line notify token>') ->message('test message'); $tranx = [ 'type' => 'onetime', // onetime | repeat 'start' => '2023-11-10 15:00', 'end' => '2023-11-10 15:00', // requried if type = repeat 'next' => 2, // minute | requried if type = repeat ]; $notibot = Notibot::create($tranx,$email,$line); return $notibot; }
Get all transaction :
$notibot = new Notibot(); // Get all $transactions = $notibot->transactions(); // Pages seperate $transactions = $notibot->transactions($perPage,$page);
View transaction by id :
$notibot = new Notibot(); // Get id from other transaction : response->data $transaction = $notibot->transaction($transactionId);
Update transaction by id :
use W3Devmaster\Notibot\Notibot; use W3Devmaster\Notibot\Sender\Email; use W3Devmaster\Notibot\Sender\LineNotify; public function update($transactionId) { $email = new Email(); $email->to('to-email@domain.com') ->subject('test') ->sender('sender-email@domain.com') ->content([ 'title' => 'Email Title', 'message' => 'Email Message', 'footer' => 'Email Footer', ]); $line = new LineNotify(); $line->to('<your line notify token>') ->message('test message'); $tranx = [ 'type' => 'onetime', // onetime | repeat 'start' => '2023-11-10 15:00', 'end' => '2023-11-10 15:00', // requried if type = repeat 'next' => 2, // minute | requried if type = repeat ]; $notibot = Notibot::update($transactionId,$tranx,$email,$line); return $notibot; }
Delete transaction by id :
$notibot = new Notibot(); // Get id from other transaction : response->data $notibot->delete($transactionId);
Get send logs :
$notibot = new Notibot(); // Get all logs $logs = $notibot->logs(); // Pages seperate $logs = $notibot->logs($perPage,$page);
View send logs :
$notibot = new Notibot(); // Log id from send logs $logs = $notibot->log($logsId);
Changelog
Please see CHANGELOG for more information what has changed recently.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-06