gdpa/chabok
Composer 安装命令:
composer require gdpa/chabok
包简介
Chabok Notifications driver
README 文档
README
This package makes it easy to sent Chabok Notifications with Laravel 5.3+.
Contents
Installation
You can install the package via composer:
composer require gdpa/chabok
Install for laravel 7:
composer require gdpa/chabok:^3.1
Install for laravel 6:
composer require gdpa/chabok:^2.0
Install for laravel < 5.8:
composer require gdpa/chabok:^1.0
Setting up the Chabok service
Add your Chabok REST API Key to your config/services.php:
// config/services.php ... 'chabok' => [ 'app_id' => env('CHABOK_APP_ID'), 'key' => env('CHABOK_API_KEY'), ], ...
You can add additional configuration for adding to request from config:
// config/services.php ... 'chabok' => [ 'app_id' => env('CHABOK_APP_ID'), 'key' => env('CHABOK_API_KEY'), 'additional' => [ 'timeout' => 5, 'request_timeout' => 10 ] ], ...
Note: If you want to test chabok set app_id to sandbox.
Usage
Now you can use the channel in your via() method inside the notification:
use NotificationChannels\Chabok\ChabokChannel; use NotificationChannels\Chabok\ChabokMessage; use Illuminate\Notifications\Notification; class ProjectCreated extends Notification { public function via($notifiable) { return [ChabokChannel::class]; } public function toChabok($notifiable) { return ChabokMessage::create() ->content("This is the Chabok notification description") ->data(['id' => 1, 'title' => 'This is notification data']); } }
In order to let your Notification know which Chabok user you are targeting, add the routeNotificationForChabok method to your Notifiable model.
This method needs to return an uuid containing the your registered token on chabok.
public function routeNotificationForChabok() { return [ 'uuid' => 'user-uuid-which-set-on-chabok-by-client', ]; }
Available methods
content(''): Accepts a string value for the Chabok notification content.trackId(''): Accepts a string value for the Chabok notification trackId.inApp(): Call this if you want to set the Chabok notification inApp to true.live(): Call this if you want to set the Chabok notification live to true.alert('''): Call this with no parameters if you want to set the Chabok notification useAsAlert to true. If you provide some string, it will set as alert text.ttl(''): Accepts a integer value for the Chabok notification ttl.data([]): Accepts a array for the Chabok notification data.fallback([]): Accepts a array for the Chabok notification fallback.clientId(''): Accepts a string value for the Chabok notification clientId.notification([]): Accepts a array for the Chabok notification notification.idr(): Call this if you want to set the Chabok notification idr to true.silent(): Call this if you want to set the Chabok notification silent to true.binary(''): Accepts a string value for the Chabok notification contentBinary.type(''): Accepts a string value for the Chabok notification contentType.id(''): Accepts a number value for the Chabok notification id.
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/chabok 适用场景与选型建议
gdpa/chabok 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.97k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2018 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gdpa/chabok 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gdpa/chabok 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-18