natsumework/laravel-notification-mitake
Composer 安装命令:
composer require natsumework/laravel-notification-mitake
包简介
:package_description
README 文档
README
This package(non-official) makes it easy to send notifications using Mitake with Laravel 5.5+ and 6.x and 7.x
Here's the latest documentation on Laravel's Notifications System:
https://laravel.com/docs/master/notifications
Contents
Installation
composer require natsumework/laravel-notification-mitake
Setting up the Mitake service
Add your Mitake Account, Password, and Api endpoint url (optional) to your config/services.php:
// config/services.php
...
'mitake' => [
'username' => env('MITAKE_USERNAME'), // reqired
'password' => env('MITAKE_PASSWORD'), // reqired
'url' => env('MITAKE_URL'), // optional (has default value): e.g. 'https://{三竹網域名稱}/api/mtk/SmSend
],
...
Usage
Now you can use the channel in your via() method inside the notification:
use NotificationChannels\Mitake\MitakeChannel;
use NotificationChannels\Mitake\MitakeMessage;
use Illuminate\Notifications\Notification;
class SmsNotification extends Notification
{
public function via($notifiable)
{
return [MitakeChannel::class];
}
public function toMitake($notifiable)
{
return (new MitakeMessage())
->content("Your message...");
}
}
You can also set 'dstaddr' or 'vldtime' or 'clientid' option (about the options please refer to the mitake api docs):
class SmsNotification extends Notification
{
...
public function toMitake($notifiable)
{
return (new MitakeMessage())
->content("Your message...")
->to("0900000000") // dstaddr: phone number
->vldTime("900") // Validity period: 900 second
->clientId("ce910656-7bd1-11ea-bc55-0242ac130003"); //Check duplicate sending
}
...
Phone number
In order to let your Notification know which phone are you sending to, you need to set the phone number in MitakeMessage
class SmsNotification extends Notification
{
...
public function toMitake($notifiable)
{
return (new MitakeMessage())
->to("0900000000") // dstaddr: phone number
...
}
...
You can also add the routeNotificationForMitake method to your Notifiable model.
public function routeNotificationForMitake()
{
return '0900000000';
}
or you can use the on-demand-notifications
Notification::route('mitake', '0900000000')
->notify(new SmsNotification($message));
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email natsumework0902@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.
natsumework/laravel-notification-mitake 适用场景与选型建议
natsumework/laravel-notification-mitake 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 383 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 natsumework/laravel-notification-mitake 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 natsumework/laravel-notification-mitake 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 383
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-11