承接 thibaud-dauce/laravel-notifications-mattermost 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thibaud-dauce/laravel-notifications-mattermost

最新稳定版本:1.7.0

Composer 安装命令:

composer require thibaud-dauce/laravel-notifications-mattermost

包简介

Send Laravel Notifications via Mattermost

README 文档

README

Installation

composer require thibaud-dauce/laravel-notifications-mattermost

Creating your webhook URL in Mattermost

Follow the official documentation https://docs.mattermost.com/developer/webhooks-incoming.html.

Usage

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use ThibaudDauce\Mattermost\MattermostChannel;
use ThibaudDauce\Mattermost\Message as MattermostMessage;

class TicketWasOpenedByCustomer extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [MattermostChannel::class];
    }

    /**
     * Get the Mattermost representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \ThibaudDauce\Mattermost\Message
     */
    public function toMattermost($notifiable)
    {
        return (new MattermostMessage)
            ->username('Helpdesk')
            ->iconUrl(url('/images/logo_only.png'))
            ->text("A new ticket has been opened.")
            ->attachment(function ($attachment) {
                $attachment->authorName($notifiable->name)
                    ->title("[Ticket #1] Title of the ticket", '/tickets/1')
                    ->text("Message of **the ticket**"); // Markdown supported.
            });
    }
}

For all the possibilities with the Message and the Attachment see https://github.com/ThibaudDauce/mattermost-php.

Routing a message

/**
 * Route notifications for the Mattermost channel.
 *
 * @return int
 */
public function routeNotificationForMattermost()
{
    return $this->mattermost_webhook_url;
}

…

统计信息

  • 总下载量: 116.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-29