gdpa/kavenegar
Composer 安装命令:
composer require gdpa/kavenegar
包简介
Kavenegar Notifications driver
README 文档
README
This package makes it easy to sent Kavenegar Notifications with Laravel 5.3+.
Contents
Installation
You can install the package via composer:
composer require gdpa/kavenegar
Install for laravel 7:
composer require gdpa/kavenegar:^3.4
Install for laravel 6:
composer require gdpa/kavenegar:^2.0
Install for laravel < 5.8:
composer require gdpa/kavenegar:^1.0
Setting up the Kavenegar service
Add your Kavenegar REST API Key to your config/services.php:
// config/services.php ... 'kavenegar' => [ 'api_key' => env('KAVENEGAR_API_KEY'), ], ...
Usage
There are two channels that you can use in your via() method inside the notification:
KavenegarChannel which represent simple send api and KavenegarVerifyChannel which provide verify lookup api.
use NotificationChannels\Kavenegar\KavenegarChannel; use NotificationChannels\Kavenegar\KavenegarMessage; use Illuminate\Notifications\Notification; class ProjectCreated extends Notification { public function via($notifiable) { return [KavenegarChannel::class]; } public function toKavenegar($notifiable) { return KavenegarMessage::create() ->sender("your-desired-sender-number") ->message('Hello world'); } }
use NotificationChannels\Kavenegar\KavenegarVerifyChannel; use NotificationChannels\Kavenegar\KavenegarMessage; use Illuminate\Notifications\Notification; class ProjectCreated extends Notification { public function via($notifiable) { return [KavenegarVerifyChannel::class]; } public function toKavenegar($notifiable) { return KavenegarMessage::create() ->template("your-template-key(Refer to Kavenegar Docs)") ->type('sms') ->token('your default token on your verify message template') ->token('additional token data. For example token10', 10); } }
In order to let your Notification know which Kavenegar user you are targeting, add the routeNotificationForKavenegar method to your Notifiable model.
This method needs to return an array containing the mobile number of your receptor.
public function routeNotificationForKavenegar() { return [ 'mobile_number' => 'receptor mobile number', ]; }
Available methods
sender(''): Accepts a string value for setting sender number on kavenegar.message(): Accepts a string value for setting your sms message.template(): Accepts a string value for setting your sms template.type(): Accepts a string value for setting your service type (sms, voice, ...).tokens(): Accepts two string value for setting your tokens. Second string is optional and in case you don't provide it, it set your default token.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email morteza.poussaneh@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.
gdpa/kavenegar 适用场景与选型建议
gdpa/kavenegar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.71k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gdpa/kavenegar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gdpa/kavenegar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-24