PHPackages                             samrat415/mattermost-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. samrat415/mattermost-laravel

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

samrat415/mattermost-laravel
============================

Get Laravel Exception alerts on mattermost channels

v1.0.0(1y ago)10359[4 PRs](https://github.com/samrat415/mattermost-laravel/pulls)MITPHPPHP ^8.3CI passing

Since Jun 10Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/samrat415/mattermost-laravel)[ Packagist](https://packagist.org/packages/samrat415/mattermost-laravel)[ Docs](https://github.com/samrat415/mattermost-laravel)[ GitHub Sponsors](https://github.com/samrat415)[ RSS](/packages/samrat415-mattermost-laravel/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (13)Versions (8)Used By (0)

🚨 Mattermost Laravel [![Total Downloads](https://camo.githubusercontent.com/fb0d3a1c6fc9ad4837c78f4b60d61d73b74ef3e78b0b7266066c6b8db17135b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616d7261743431352f6d61747465726d6f73742d6c61726176656c3f7374796c653d666f722d7468652d626164676526636f6c6f723d627269676874677265656e)](https://packagist.org/packages/samrat415/mattermost-laravel)
========================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-mattermost-laravel-)

A Laravel package to send exception alerts directly to [Mattermost](https://mattermost.com) via incoming webhooks.
Built using [Spatie Laravel Package Tools](https://github.com/spatie/laravel-package-tools) for clean and automatic integration.

---

🧭 Overview
----------

[](#-overview)

This package catches exceptions in non-API requests and automatically sends a rich, formatted message to your Mattermost channel with details like:

- App/environment
- Host
- User info
- URL &amp; payload
- Exception message, file, and line

---

🖼️ Screenshots
--------------

[](#️-screenshots)

**Step-by-step setup:**

StepImage1️⃣ Add incoming webhook[![Step 1](screenshots/mattermost-step-1.png)](screenshots/mattermost-step-1.png)2️⃣ Configure channel &amp; description[![Step 2](screenshots/mattermost-step-2.png)](screenshots/mattermost-step-2.png)3️⃣ Copy the webhook URL[![Step 3](screenshots/mattermost-step-3.png)](screenshots/mattermost-step-3.png)**Example Message on Web &amp; Mobile:**

WebMobile[![Web](screenshots/message-web.png)](screenshots/message-web.png)[![Mobile](screenshots/message-mobile.jpg)](screenshots/message-mobile.jpg)---

📦 Installation
--------------

[](#-installation)

```
composer require samrat415/mattermost-laravel
```

---

⚙️ Setup
--------

[](#️-setup)

### 1. 🧪 Create Incoming Webhook on Mattermost

[](#1--create-incoming-webhook-on-mattermost)

Follow the screenshots above or these steps:

- Go to **Main Menu &gt; Integrations &gt; Incoming Webhooks**
- Click **Add Incoming Webhook**
- Select the channel and give a name like `Laravel Alerts`
- Copy the generated **Webhook URL**

---

### 2. 🔐 Environment Variables

[](#2--environment-variables)

Add the following to your `.env` file:

```
MATTERMOST_WEBHOOK_URL=https://your-mattermost/hooks/your-webhook-url
MATTERMOST_ALERT_ENABLED=true
MATTERMOST_REDIRECT_BACK=true
```

KeyDescription`MATTERMOST_WEBHOOK_URL`Your Mattermost webhook URL`MATTERMOST_ALERT_ENABLED`Set to `false` to temporarily disable notifications`MATTERMOST_REDIRECT_BACK`Set to `false` to prevent redirecting back after an error---

### 3. ⚙️ Publish Config (Optional)

[](#3-️-publish-config-optional)

```
php artisan vendor:publish --tag="mattermost-laravel-config"
```

This will publish the configuration file to:

```
config/mattermost-alert.php

```

---

✅ Automatic Exception Reporting
-------------------------------

[](#-automatic-exception-reporting)

This package automatically hooks into Laravel’s exception handling:

- Only for **non-API web requests**
- Catches exceptions and reports to Mattermost
- Optionally redirects back with flash alert

---

🧾 Blade Alert Message (Optional UI)
-----------------------------------

[](#-blade-alert-message-optional-ui)

To show the alert message on your front-end after exception handling, add this snippet to your main layout file:

```
@if (session()->has('alert'))

                @if (session()->get('alert')['type'] === 'success')

                @elseif(session()->get('alert')['type'] === 'danger')

                @else

                @endif

            &nbsp;
            {{ session()->get('alert')['title'] }}

        {{ session()->get('alert')['message'] }}

@endif
```

---

🧪 Testing
---------

[](#-testing)

Throw an exception anywhere in your Laravel web route or controller to test. If everything is configured properly, the error will show up in your Mattermost channel.

---

🔒 License
---------

[](#-license)

MIT © [Samrat Thapa](https://github.com/samrat415)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance69

Regular maintenance activity

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

389d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6e64696eaba7af48ffc0345baa32ac261b46fbda83f3ca92901cec27fa59360?d=identicon)[samrat415](/maintainers/samrat415)

---

Top Contributors

[![samrat415](https://avatars.githubusercontent.com/u/43883707?v=4)](https://github.com/samrat415 "samrat415 (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelsamrat415mattermost-laravel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/samrat415-mattermost-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/samrat415-mattermost-laravel/health.svg)](https://phpackages.com/packages/samrat415-mattermost-laravel)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
