PHPackages                             parhamafkar/laravel-mattermost - 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. parhamafkar/laravel-mattermost

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

parhamafkar/laravel-mattermost
==============================

Laravel package to log messages to Mattermost using both Bot API and Webhooks

v1.2(1mo ago)01.0k↑33.3%MITPHPPHP ^8.2

Since Jun 4Pushed 1mo agoCompare

[ Source](https://github.com/parham-afkar/laravel-mattermost)[ Packagist](https://packagist.org/packages/parhamafkar/laravel-mattermost)[ RSS](/packages/parhamafkar-laravel-mattermost/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (8)Used By (0)

Laravel Mattermost Logger
=========================

[](#laravel-mattermost-logger)

A Laravel logging package that supports **Mattermost Bot** and **Incoming Webhook** integrations.

This package allows you to:

- Send Laravel logs directly to Mattermost
- Dynamically choose a Mattermost channel per log entry
- Use either Bot API or Webhook connections
- Control log visibility and structure with context data

---

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

[](#-installation)

```
composer require parhamafkar/laravel-mattermost
```

---

⚙️ Configuration
----------------

[](#️-configuration)

### 1. Publish configuration file

[](#1-publish-configuration-file)

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

---

### 2. Add custom log driver

[](#2-add-custom-log-driver)

```
'mattermost' => [
    'driver' => 'custom',
    'via' => ParhamAfkar\MattermostLogger\LogChannel::class,
    'level' => env('MATTERMOST_LOG_LEVEL', 'debug'),
    'channel' => env('MATTERMOST_CHANNEL', 'town-square'),
    'type' => env('MATTERMOST_TYPE', 'bot'),
],
```

---

### 3. Add Mattermost to stack channel

[](#3-add-mattermost-to-stack-channel)

```
'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'mattermost'],
],
```

---

### 4. Environment variables

[](#4-environment-variables)

```
MATTERMOST_TYPE=bot
MATTERMOST_BASE_URL=https://xyz.mattermost.xyz
MATTERMOST_BOT_TOKEN=your-bot-token-here
MATTERMOST_CHANNEL_PREFIX="develop-"

MATTERMOST_WEBHOOK_URL=https://xyz.mattermost.xyz/hooks/your-webhook-token

MATTERMOST_CHANNEL=town-square
MATTERMOST_USERNAME="Laravel Logger"
MATTERMOST_ICON_URL=
MATTERMOST_LOG_LEVEL=debug
```

---

✅ Usage
-------

[](#-usage)

### Facade

[](#facade)

```
Mattermost::send('Hello from Laravel!');
Mattermost::channel('errors')->send('Error message', [
    'user_id' => 1,
]);
```

---

### Laravel Log

[](#laravel-log)

```
Log::channel('mattermost')->info('User logged in', [
    'channel' => 'user-activity',
]);
```

---

🧪 Artisan Commands
------------------

[](#-artisan-commands)

```
php artisan mattermost:test
php artisan mattermost:test --channel=errors
php artisan mattermost:channels
```

---

📋 Available Methods
-------------------

[](#-available-methods)

```
Mattermost::send(string $message, array $context = []);
Mattermost::channel(string $channel)->send(string $message, array $context = []);
Mattermost::type('webhook')->send(string $message, array $context = []);
```

---

🔧 Channel Resolution
--------------------

[](#-channel-resolution)

Supports:

- Channel name
- Channel ID
- Prefixed channel ID

Private channels require bot membership.

---

📄 License
---------

[](#-license)

MIT

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance90

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~49 days

Recently: every ~74 days

Total

7

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/73f72b0bea01e2d25d7ce4a7875bd3c1a1b6e5a9aee8f2b235e39ff943201bc7?d=identicon)[parhamafkar](/maintainers/parhamafkar)

---

Top Contributors

[![parham-afkar](https://avatars.githubusercontent.com/u/90577296?v=4)](https://github.com/parham-afkar "parham-afkar (13 commits)")

### Embed Badge

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

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

###  Alternatives

[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

299549.3k1](/packages/larabug-larabug)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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