<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abdullah Alhumsi</title>
    <description>The latest articles on DEV Community by Abdullah Alhumsi (@abdullah_alhumsi_f0769b25).</description>
    <link>https://dev.to/abdullah_alhumsi_f0769b25</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3907687%2Fb3af4bc6-39b7-4377-af67-1b7949f27d21.jpg</url>
      <title>DEV Community: Abdullah Alhumsi</title>
      <link>https://dev.to/abdullah_alhumsi_f0769b25</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abdullah_alhumsi_f0769b25"/>
    <language>en</language>
    <item>
      <title>How I Built a Laravel Package to Send Error Alerts to Telegram, Slack &amp; Discord</title>
      <dc:creator>Abdullah Alhumsi</dc:creator>
      <pubDate>Fri, 01 May 2026 14:42:25 +0000</pubDate>
      <link>https://dev.to/abdullah_alhumsi_f0769b25/how-i-built-a-laravel-package-to-send-error-alerts-to-telegram-slack-discord-1jld</link>
      <guid>https://dev.to/abdullah_alhumsi_f0769b25/how-i-built-a-laravel-package-to-send-error-alerts-to-telegram-slack-discord-1jld</guid>
      <description>&lt;p&gt;Every Laravel app breaks in production. The question is: do you &lt;br&gt;
find out before your users do?&lt;/p&gt;

&lt;p&gt;I got tired of checking logs manually and built a package that &lt;br&gt;
sends instant, actionable error alerts to Telegram, Slack, and &lt;br&gt;
Discord the moment something breaks.&lt;/p&gt;

&lt;p&gt;Here's how I built it and what I learned.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Most Laravel error monitoring solutions are either too expensive,&lt;br&gt;
too complex to set up, or send you a generic alert with no context.&lt;/p&gt;

&lt;p&gt;I wanted something that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sends alerts instantly to channels I already use&lt;/li&gt;
&lt;li&gt;Shows me exactly what broke and where&lt;/li&gt;
&lt;li&gt;Suggests what to do about it&lt;/li&gt;
&lt;li&gt;Is dead simple to install&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built &lt;strong&gt;laravel-error-notifier&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  What It Does
&lt;/h2&gt;

&lt;p&gt;The package hooks into Laravel's exception handler and sends &lt;br&gt;
a formatted alert to your configured channels the moment an &lt;br&gt;
exception is thrown in production.&lt;/p&gt;

&lt;p&gt;A Telegram alert looks like this:&lt;/p&gt;

&lt;p&gt;🚨 &lt;strong&gt;EMERGENCY&lt;/strong&gt; | your-app.com&lt;br&gt;
&lt;strong&gt;QueryException&lt;/strong&gt;&lt;br&gt;
SQLSTATE[42S02]: Table 'users' doesn't exist&lt;br&gt;
📁 &lt;code&gt;app/Services/UserService.php:45&lt;/code&gt;&lt;br&gt;
💡 &lt;strong&gt;Suggestion:&lt;/strong&gt; Check your migration status&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require alhumsi/laravel-error-notifier
php artisan vendor:publish &lt;span class="nt"&gt;--tag&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;error-notifier-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Add your channel credentials to &lt;code&gt;.env&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;ERROR_NOTIFIER_TELEGRAM_BOT_TOKEN=your-token&lt;br&gt;
ERROR_NOTIFIER_TELEGRAM_CHAT_ID=your-chat-id&lt;br&gt;
ERROR_NOTIFIER_SLACK_WEBHOOK=&lt;a href="https://hooks.slack.com/" rel="noopener noreferrer"&gt;https://hooks.slack.com/&lt;/a&gt;...&lt;br&gt;
ERROR_NOTIFIER_DISCORD_WEBHOOK=&lt;a href="https://discord.com/api/webhooks/" rel="noopener noreferrer"&gt;https://discord.com/api/webhooks/&lt;/a&gt;...&lt;/p&gt;

&lt;p&gt;That's it. No manual registration needed — the package &lt;br&gt;
auto-discovers itself.&lt;/p&gt;
&lt;h2&gt;
  
  
  How It Works Under the Hood
&lt;/h2&gt;

&lt;p&gt;The package uses three core abstractions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AnalyzerInterface&lt;/strong&gt; — maps exception types to severity levels.&lt;br&gt;
A &lt;code&gt;QueryException&lt;/code&gt; is &lt;code&gt;critical&lt;/code&gt;. A &lt;code&gt;ValidationException&lt;/code&gt; is &lt;code&gt;error&lt;/code&gt;.&lt;br&gt;
You can override this with your own analyzer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MessageFormatterInterface&lt;/strong&gt; — formats the alert for each channel.&lt;br&gt;
Telegram uses MarkdownV2. Slack uses Block Kit. Discord uses embeds.&lt;br&gt;
Each formatter produces a channel-native message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NotifierInterface&lt;/strong&gt; — sends the formatted message via HTTP.&lt;br&gt;
Swap this with a queue-backed implementation for async delivery.&lt;/p&gt;
&lt;h2&gt;
  
  
  Routing Alerts by Severity
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;config/error-notifier.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'levels'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'emergency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'slack'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'telegram'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="s1"&gt;'critical'&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'slack'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="s1"&gt;'error'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'discord'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;High-severity alerts go to Slack where your team sees them &lt;br&gt;
immediately. Lower severity goes to Discord as a log channel. &lt;br&gt;
You decide what goes where.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Icons Per Severity
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'icons'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'emergency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'🚨'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'critical'&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'🔥'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'error'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'❌'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'warning'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'⚠️'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small detail but it makes alerts scannable at a glance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned Building This
&lt;/h2&gt;

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

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

&lt;p&gt;&lt;strong&gt;3. Write tests from day one.&lt;/strong&gt;&lt;br&gt;
I wrote tests before the implementation was complete. It forced &lt;br&gt;
me to think about the public API first and made the code &lt;br&gt;
significantly cleaner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require alhumsi/laravel-error-notifier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub: &lt;a href="https://github.com/Alhumsiabdo/laravel-error-notifier" rel="noopener noreferrer"&gt;https://github.com/Alhumsiabdo/laravel-error-notifier&lt;/a&gt;&lt;br&gt;
Packagist: &lt;a href="https://packagist.org/packages/alhumsi/laravel-error-notifier" rel="noopener noreferrer"&gt;https://packagist.org/packages/alhumsi/laravel-error-notifier&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you find it useful, a ⭐ on GitHub goes a long way.&lt;/p&gt;

&lt;p&gt;What error monitoring are you using in your Laravel apps? &lt;br&gt;
I'd love to know in the comments.&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
