thibaud-dauce/laravel-notifications-mattermost
Send Laravel Notifications via Mattermost
153,698
17
| Install | |
|---|---|
composer require thibaud-dauce/laravel-notifications-mattermost |
|
| Latest Version: | 1.8.0 |
| PHP: | >=5.6.4 |
| Laravel: | 5 – 13 |
| License: | MIT |
| Last Updated: | Mar 20, 2026 |
| Links: | GitHub · Packagist |
Maintainer: ThibaudDauce
Laravel Notifications for Mattermost
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;
}
…
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
644,549,754
9,698
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
423,477,751
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
399,241,428
4,660
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.8.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.7.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.6.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.5.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.4.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.3.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.2.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.1.0 | >=5.6.4 | ^5.3| | MIT | |
| 1.0.0 | >=5.6.4 | ^5.3 | MIT |