惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Engineering at Meta
Engineering at Meta
腾讯CDC
宝玉的分享
宝玉的分享
H
Help Net Security
I
InfoQ
博客园 - Franky
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
博客园_首页
美团技术团队
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
The Cloudflare Blog
博客园 - 司徒正美
Vercel News
Vercel News
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
月光博客
月光博客

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How I Built a Laravel Package to Send Error Alerts to Tel...
Abdullah Alh · 2026-05-01 · via DEV Community

Abdullah Alhumsi

Every Laravel app breaks in production. The question is: do you
find out before your users do?

I got tired of checking logs manually and built a package that
sends instant, actionable error alerts to Telegram, Slack, and
Discord the moment something breaks.

Here's how I built it and what I learned.

The Problem

Most Laravel error monitoring solutions are either too expensive,
too complex to set up, or send you a generic alert with no context.

I wanted something that:

  • Sends alerts instantly to channels I already use
  • Shows me exactly what broke and where
  • Suggests what to do about it
  • Is dead simple to install

So I built laravel-error-notifier.

What It Does

The package hooks into Laravel's exception handler and sends
a formatted alert to your configured channels the moment an
exception is thrown in production.

A Telegram alert looks like this:

🚨 EMERGENCY | your-app.com
QueryException
SQLSTATE[42S02]: Table 'users' doesn't exist
📁 app/Services/UserService.php:45
💡 Suggestion: Check your migration status

Installation

composer require alhumsi/laravel-error-notifier
php artisan vendor:publish --tag=error-notifier-config

Enter fullscreen mode Exit fullscreen mode

Add your channel credentials to .env:

ERROR_NOTIFIER_TELEGRAM_BOT_TOKEN=your-token
ERROR_NOTIFIER_TELEGRAM_CHAT_ID=your-chat-id
ERROR_NOTIFIER_SLACK_WEBHOOK=https://hooks.slack.com/...
ERROR_NOTIFIER_DISCORD_WEBHOOK=https://discord.com/api/webhooks/...

That's it. No manual registration needed — the package
auto-discovers itself.

How It Works Under the Hood

The package uses three core abstractions:

AnalyzerInterface — maps exception types to severity levels.
A QueryException is critical. A ValidationException is error.
You can override this with your own analyzer.

MessageFormatterInterface — formats the alert for each channel.
Telegram uses MarkdownV2. Slack uses Block Kit. Discord uses embeds.
Each formatter produces a channel-native message.

NotifierInterface — sends the formatted message via HTTP.
Swap this with a queue-backed implementation for async delivery.

Routing Alerts by Severity

In config/error-notifier.php:

'levels' => [
    'emergency' => ['slack', 'telegram'],
    'critical'  => ['slack'],
    'error'     => ['discord'],
],

Enter fullscreen mode Exit fullscreen mode

High-severity alerts go to Slack where your team sees them
immediately. Lower severity goes to Discord as a log channel.
You decide what goes where.

Custom Icons Per Severity

'icons' => [
    'emergency' => '🚨',
    'critical'  => '🔥',
    'error'     => '❌',
    'warning'   => '⚠️',
],

Enter fullscreen mode Exit fullscreen mode

Small detail but it makes alerts scannable at a glance.

What I Learned Building This

1. Contracts make packages extensible.
Every core behavior is behind an interface. Users can swap
the analyzer, formatter, or notifier without touching package code.
This is the difference between a package people use and one
they fork and modify.

2. Auto-discovery matters.
Adding a ServiceProvider to config/app.php is a friction point.
Laravel's package auto-discovery removes that friction entirely.
Less friction = more installs.

3. Write tests from day one.
I wrote tests before the implementation was complete. It forced
me to think about the public API first and made the code
significantly cleaner.

Try It

composer require alhumsi/laravel-error-notifier

Enter fullscreen mode Exit fullscreen mode

GitHub: https://github.com/Alhumsiabdo/laravel-error-notifier
Packagist: https://packagist.org/packages/alhumsi/laravel-error-notifier

If you find it useful, a ⭐ on GitHub goes a long way.

What error monitoring are you using in your Laravel apps?
I'd love to know in the comments.