komujohn/google-chat-notifier
最新稳定版本:v5.2.4
Composer 安装命令:
composer require komujohn/google-chat-notifier
包简介
Symfony Google Chat Notifier Bridge
README 文档
README
Provides Google Chat integration for Symfony Notifier. Allowing the thread key to be setup at the notification
DSN example
GOOGLE_CHAT_DSN=googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY
where:
ACCESS_KEYis your Google Chat access keyACCESS_TOKENis your Google Chat access tokenSPACEis the Google Chat spaceTHREAD_KEYis the Google Chat message thread to group messages into a single thread (optional)
Code Example
<?php
namespace App\Service;
use Symfony\Component\Notifier\Bridge\GoogleChat\ThreadNotification;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\NotifierInterface;
use Symfony\Component\Notifier\Recipient\NoRecipient;
class NotificationHelper {
private NotifierInterface $notifier;
public function __construct( NotifierInterface $notifier ) {
$this->notifier = $notifier;
}
public function sendNotification($subject,$message,$thread_key='general5'){
$notification = (new ThreadNotification())
->subject($subject)
->content($message)
->thread($thread_key)
->importance(Notification::IMPORTANCE_HIGH);
$this->notifier->send($notification, new NoRecipient());
}
}
Resources
统计信息
- 总下载量: 43
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-17