Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mattermost Notifier

Mattermost Notifier Laravel Package

symfony/mattermost-notifier

Symfony Notifier integration for Mattermost. Configure via DSN (access token, host/path, default channel) and send ChatMessage notifications, optionally overriding the recipient channel with MattermostOptions.

View on GitHub
Deep Wiki
Context7

Symfony Mattermost Notifier Bridge

Frequently asked questions about Mattermost Notifier
Can I use this package to send Mattermost notifications from Laravel event listeners?
Yes, this package integrates with Symfony Notifier, which works well with Laravel’s event system. You can trigger notifications in event listeners by instantiating the `Notifier` and `MattermostTransport` classes, then sending messages via the `ChatMessage` class. For example, handle a `JobFailed` event by dispatching a Mattermost notification with the failure details.
What Laravel versions does this package support?
This package is Symfony-based and doesn’t enforce Laravel-specific version constraints, but it works with Laravel 8+ due to its PHP 8.0+ requirements. Ensure your Laravel app uses PHP 8.0 or higher and Symfony’s HttpClient (or replace it with Laravel’s Http client) for compatibility. Test thoroughly with your Laravel version to confirm stability.
How do I configure the Mattermost DSN in Laravel?
Store the Mattermost DSN in your `.env` file as `MATTERMOST_DSN=mattermost://ACCESS_TOKEN@HOST/PATH?channel=CHANNEL_ID`. Access it in Laravel using `config('services.mattermost.dsn')` or directly via `env('MATTERMOST_DSN')`. The DSN format includes your Mattermost access token, host, optional path, and default channel ID, making it easy to centralize configuration.
Will this package block my Laravel application if Mattermost is unreachable?
By default, the package uses synchronous HTTP requests, which could block your app if Mattermost is down. To avoid this, dispatch notifications via Laravel’s queue system (e.g., `bus:queue` or `dispatchSync()`) to handle failures gracefully. Wrap the notification logic in a job and use Laravel’s `FailedJob` table for retries.
Can I mock Mattermost responses for testing in Laravel?
Yes, you can mock Mattermost responses by replacing Symfony’s `HttpClient` with Laravel’s `Http` facade or Guzzle, then use Laravel’s mocking tools like `Http::fake()` to simulate successful or failed webhook deliveries. For unit tests, inject a mock `MattermostTransport` or override the HTTP client dependency in your test container.
Does this package support Laravel’s notification system (e.g., Notifiable trait)?
Not natively, but you can extend Laravel’s `ChannelInterface` to wrap this package’s `Notifier`. Create a custom channel class that uses `MattermostTransport` and integrate it with Laravel’s notification system. This allows you to send Mattermost notifications alongside emails or other channels via `Notification::send($user, $notification)`.
How do I handle authentication securely in Laravel?
Store your Mattermost access token in Laravel’s `.env` file (e.g., `MATTERMOST_TOKEN=your_token_here`) and access it via `env('MATTERMOST_TOKEN')`. For production, consider using Laravel’s Vault or a secrets manager to avoid hardcoding tokens. Never commit `.env` files to version control, and restrict access to sensitive configuration files.
Are there alternatives to this package for Laravel Mattermost notifications?
Yes, for a Laravel-native solution, consider `spatie/laravel-notification-channels-mattermost`, which integrates directly with Laravel’s notification system. If you’re already using Symfony components, this package offers tighter integration with Symfony Notifier but requires manual adaptation for Laravel. Choose based on your stack preference and need for Symfony-specific features.
How do I customize Mattermost message formatting (e.g., markdown, attachments) in Laravel?
Use Mattermost’s `ChatMessage` class to format messages with markdown or attachments. For dynamic content, pass Blade-templated strings or use Laravel’s `Str::markdown()` to render messages before sending. The package supports rich formatting, but ensure your Mattermost server version supports the features you need (e.g., Slack-compatible markdown).
What’s the best way to log failed Mattermost notifications in Laravel?
Leverage Laravel’s logging system to track failures. Wrap the notification call in a `try-catch` block and log exceptions using `Log::error()`, including the Mattermost response (if available). For queued notifications, Laravel’s `FailedJob` table will automatically log failures, which you can monitor via `php artisan queue:failed`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views