alhumsi / laravel-error-notifier
Laravel package for actionable error notifications and auto actions
Package info
github.com/Alhumsiabdo/laravel-error-notifier
pkg:composer/alhumsi/laravel-error-notifier
Requires
- php: >=8.2
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.5|^12.0
- dev-stage
- v1.0.0
- dev-fix/smart-fingerprinting
- dev-update/change-images
- dev-add/icon-error-level
- dev-add/upoad-images
- dev-update/README.md
- dev-create/test-files
- dev-bug/fix-send-notification
- dev-bug/fix-level-errors-return-right
- dev-feat/locking-middleware
- dev-feat/auto-maintenance-mode-action
- dev-feat/everity_levels_auto_actions_config
- dev-docs_readme_examples
- dev-tests-CI-setup-MVP
- dev-config_publishable_config
- dev-feat/notification_channels-telegram-slack
- dev-feat/formatter_template_engine
- dev-error-analyzer-core
- dev-feat/exception-listener-hook-into-Handler)
- dev-Alhumsiabdo-patch-3
- dev-main
- dev-Alhumsiabdo-patch-2
- dev-Alhumsiabdo-patch-1
This package is auto-updated.
Last update: 2026-02-26 15:37:43 UTC
README
Laravel package for actionable error notifications (Telegram, Slack, Discord) with contextual analysis and actionable suggestions.
Highlights
- Auto-wires into Laravelβs exception handler once the service provider boots.
- Ships with Analyzer, MessageFormatter and Notifier abstractions for easy extension.
- Supports Slack, Telegram and Discord out of the box (drop-in HTTP hooks).
- Maps exception types to severity levels and channels, so high-signal alerts stay actionable.
- Ships with MarkdownV2-safe formatting plus JSON context blocks for deeper debugging.
Screenshots
| Slack | Telegram | Discord |
|---|---|---|
![]() |
![]() |
![]() |
Requirements
- PHP 8.2+
- Laravel 10.x, 11.x or 12.x (or any app relying on Illuminate components)
- Enabled HTTP client (
Illuminate\Support\Facades\Http) - Optional: queue workers if you decide to dispatch notifications asynchronously
Installation
composer require alhumsi/laravel-error-notifier php artisan vendor:publish --tag=error-notifier-config
Add the following to your .env (only the services you plan to use are required):
ERROR_NOTIFIER_SLACK_WEBHOOK=https://hooks.slack.com/services/xxx/yyy/zzz
ERROR_NOTIFIER_TELEGRAM_BOT_TOKEN=123456:ABC
ERROR_NOTIFIER_TELEGRAM_CHAT_ID=123456789
ERROR_NOTIFIER_DISCORD_WEBHOOK=https://discord.com/api/webhooks/xxx/yyy
ERROR_NOTIFIER_THROTTLE_ENABLED=true
ERROR_NOTIFIER_MAINTENANCE_ENABLED=false
The package auto-discovers its service provider. No manual edits to
config/app.phpare necessary.
Quickstart
- Install and publish the config (see above).
- Adjust
config/error-notifier.phplevels and channels:'levels' => [ 'emergency' => ['slack', 'telegram'], 'critical' => ['slack'], 'error' => ['discord'], ];
- Map custom exceptions to levels under the
analyzersarray. - Trigger any exception in your app; you should see a formatted alert on the configured channel(s).
The package hooks into Laravelβs reportable callback:
$this->app->make(\Illuminate\Contracts\Debug\ExceptionHandler::class) ->reportable(fn (Throwable $e) => app(ExceptionListener::class)->handle($e));
Configuration Essentials
channels: provide the transport credentials. Telegram needsbot_token,chat_idand optionalbot_url.levels: severity => channels mapping. Empty arrays silence that severity.analyzers: class => severity override, allowing priority routing for specific exceptions.icons: severity => emoji mapping. Customize the visual indicator for each error level.
Custom Icons
Define emojis or strings for each severity level in config/error-notifier.php:
'icons' => [ 'emergency' => 'π¨', 'critical' => 'π₯', 'error' => 'β', // ... ],
Custom Analyzer
Implement alhumsi\ErrorNotifier\Contracts\AnalyzerInterface and bind it inside a service provider:
use alhumsi\ErrorNotifier\Contracts\AnalyzerInterface; use App\Support\CustomAnalyzer; public function register() { $this->app->singleton(AnalyzerInterface::class, CustomAnalyzer::class); }
Custom Formatter
Provide your own MessageFormatterInterface implementation if you need per-channel formatting tweaks (attachments, embeds, etc.).
Custom Notifier / Async Delivery
Swap NotifierInterface with a queue-backed implementation to push payloads to jobs or any other transport you prefer.
Examples
See the additional guides under docs/:
docs/getting-started.md: full walkthrough with publishing, environments and troubleshooting.docs/examples.md: channel routing, per-project overrides, manual invocation snippets.
Local Testing
composer test
Includes an integration test (tests/ErrorFlowTest.php) that mocks the notifier and asserts both Slack and Telegram deliveries.
Package Structure
laravel-error-notifier/
βββ config/ # Configuration file
βββ docs/ # Additional documentation
βββ src/ # Source code
β βββ Console/
β β βββ FeatureLockCommand.php
β βββ Contracts/
β β βββ AnalyzerInterface.php
β β βββ MessageFormatterInterface.php
β β βββ NotifierInterface.php
β βββ Http/
β β βββ Middleware/
β β βββ CheckFeatureLock.php
β βββ Listeners/
β β βββ ExceptionListener.php
β β βββ LogListener.php
β βββ Services/
β β βββ FeatureLocker.php
β β βββ Maintainer.php
β βββ Analyzer.php # Exception analyzer
β βββ MessageFormatter.php # Notification formatter
β βββ Notifier.php # Notification sender
β βββ Throttler.php # Rate limiting logic
βββ tests/ # Automated tests
βββ vendor/ # Composer dependencies
Contributing
- Fork & clone
- Run
composer install - Add or adjust tests
- Open a PR with a summary of changes
License
MIT Β© Abdullah ALhumsi


