notifylog / laravel
实时事件通知
v1.0.0
2023-01-16 23:39 UTC
Requires
- php: ^7.3|^8.0|^8.1
Requires (Dev)
- laravel/framework: ^8|^9
This package is not auto-updated.
Last update: 2024-09-24 20:08:04 UTC
README
一个使用 NotifyLog API 发送通知的库。
安装
要安装库,运行以下命令
composer require notifylog/laravel
配置
要使用库,请配置 .env 中的账户令牌
NOTIFYLOG_ACCOUNT_TOKEN=[account_token]
您可以在 这里 找到您的账户令牌
测试配置
运行
php artisan notifylog:test
用法
然后,您可以使用 NotifyLog 的 publish 方法从您的控制器中发送通知
<?php namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; use NotifyLog\Laravel\NotifyLog; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; function index(NotifyLog $notifyLog){ $event = [ "name" => "NotifyLog Laravel Plugin", "description" => "Hello world from Laravel", "channel" => "from-laravel", "icon" => "💸", "notify" => true, "tags" => [ "my-tag" => "my-tag-value", ], "message" => "[Link](https://google.com)", ]; // Use: $notifyLog->publish($event); // or, you can also use the helper // without the need to inject // NotifyLog into the controller // by calling notifylog()->publish($event);
支持
如果您需要帮助,请发送电子邮件至 hello@notifylog.com。
创建账户
要创建 NotifyLog 平台的账户,请访问 https://notifylog.com。