asanbarco / notifier
该软件包最新版本(3.3.2)没有可用的许可信息。
3.3.2
2019-11-20 12:35 UTC
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ^6.3
- laravel/framework: ^5.0
- nesbot/carbon: ~1.0
- predis/predis: ^1.1
- dev-master
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.2
- 3.0.1
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0
- v1.2.1
- v1.2
- v1.1
- 1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-Fix
- dev-fixbug
- dev-Add_Read_All
- dev-develop
- dev-Notification-Receiver
- dev-Refactor
This package is not auto-updated.
Last update: 2024-10-01 10:42:58 UTC
README
Notifier是一个通知服务软件包,用于处理发送各种推送、短信、电子邮件和其他通知类型的过程。它基于Laravel 5.5,并通过Redis代理上的Laravel队列管理器异步发送所有通知。
安装
通过Packagist安装该软件包
composer require asanbarco/notifier
配置
将Notifier配置文件发布到您的应用程序中,并填写您想要使用的服务的配置
php artisan vendor:publish
运行迁移命令以创建notifiers架构
php artisan migrate
将以下环境添加到您的应用程序的.env
文件中,以逗号分隔,以便在通知作业中设置提供者的优先级
SMS_PROVIDERS_PRIORITY=sms0098,smsir
SMS0098_FROM=YOUR-NUMBER
SMS0098_USERNAME=YOUR-USERNAME
SMS0098_PASSWORD=YOUR-PASSWORD
SMSIR_URI=http://restfulsms.com/api/MessageSend
SMSIR_TOKEN=http://restfulsms.com/api/Token
SMSIR_API_KEY=YOUR-API-KEY
SMSIR_SECRET_KEY=YOUR-SECRET-KEY
SMSIR_LINE_NUMBER=YOUR-NUMBER
PUSH_PROVIDERS_PRIORITY=chabok,onesignal
CHABOK_URI_DEV=https://sandbox.push.adpdigital.com/api/
CHABOK_APP_ID_DEV=YOUR-ID
CHABOK_ACCESS_TOKEN_DEV=YOUR-TOKEN
CHABOK_URI=https://YOUR-ID.push.adpdigital.com/api/
CHABOK_APP_ID=YOUR-ID
CHABOK_ACCESS_TOKEN=YOUR-TOKEN
请记住,在服务器上运行队列 artisan 命令
php artisan queue:work
将您的应用程序的.env
键QUEUE_DRIVER
设置为redis
以异步运行作业
如何使用
在您的应用程序中使用Asanbar\Notifier\Notifier
接口,以下方法可用:sendPush
,sendSms
public function sendSMS(array $numbers, string $txt) { Notifier::onQueue('sms'); //if you do not set queue name it run send immediately and return result return Notifier::sendSMS($txt, $numbers); } public function sendPush(array $tokens, string $title, string $txt, ?array $data = []) { Notifier::onQueue('push'); return Notifier::sendPush($title, $txt, $tokens, $data); }
设置用户已阅读通知
Notifier::read($id);
读取数据
您可以使用基于状态和类型的通知数量
Notifier::getCounts(); Notifier::getCounts($userId); // with user iddentifier (id or mobile ...)
获取已读或未读通知
Notifier::getUnReads(); // or getReads() Notifier::getUnReads($identifier, $type, $limit); // all parameters are optional. If set limit it make paginator
开发者
重构: Mehrdad Dadkhah