定制 fantismic/alert-system 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fantismic/alert-system

Composer 安装命令:

composer require fantismic/alert-system

包简介

Reusable Laravel alerting system

README 文档

README

LaravelVersionDownloadsLicence

A reusable Laravel package to send alerts via multiple channels (e.g., mail, telegram) based on alert type and channel combinations — stored in the database for easy admin management.

✨ Features

  • Alert types like System, User (customizable)
  • Channel support: mail, telegram, discord (more to come)
  • Dynamically manage recipients from the database
  • Supports Laravel Notifications and queues
  • Uses a Facade: Alert::send(...)
  • Includes an optional dashboard with filters and search
  • Logs each alert sent per recipient and status

✅ Requirements

Mandatory

  • Laravel >= 11
  • PHP >= 8.1
  • Database migrations

Optional

  • Tailwind CSS (for UI)
  • Livewire (for UI)

📷 Screenshots

Mail

Light mode

Image description

Dark mode

Image description

Telegram

Image description

📦 Installation

composer require fantismic/alert-system

Publish migrations

php artisan vendor:publish --tag=alert-system-migrations
php artisan migrate

Publish configuration:

php artisan vendor:publish --tag=alert-system-config

You can define:

  • Which Blade layout to use for the Livewire UI
  • Which environments (envs) are allowed to send alerts
  • Set telegram token
  • Set telegram proxy
  • Set global cooldown

You can set as many telegram bots as you like here, or leave only one and use different addresses to different groups for the same bot.

Publish seeders (optional):

php artisan vendor:publish --tag=alert-system-seeders
php artisan db:seed --class=AlertTypesTableSeeder
php artisan db:seed --class=AlertChannelsTableSeeder

📁 Tables

This package creates the following tables:

  • alert_types
  • alert_channels
  • alert_recipients
  • alert_logs

Example:

Type Channel Address
System mail admin@example.com
System telegram @sysadmin_channel

🚀 Usage

use Fantismic\AlertSystem\Facades\Alert;

Alert::send('Healthcheck', '🔥 CPU is on fire');
use Fantismic\AlertSystem\Facades\Alert;

Alert::send('System', 'The disk is almost full', [
    'host' => 'web-01',
    'threshold' => '95%',
], [
    'mailSubject' => '🚨 Disk Alert',
    'cooldown' => 0,
]);

This will:

  • Look up all recipients for the given type
  • Send via all associated channels (mail, telegram)
  • Log success/failure per recipient

🧠 Signature

Alert::send(
    string $type,
    string $message,
    array $details = [],
    array $options = [] // mailSubject, cooldown
): void

🛠️ Customization

Email Templates

After publishing the views:

php artisan vendor:publish --tag=alert-system-views

You'll find the default template at:

resources/views/vendor/alert-system/mail/error_alerts/default.blade.php

Use Blade logic to customize per type (e.g., error_alerts.system.blade.php).

🖥️ Admin UI

📍 Routes

Path Route Name
/admin/alerts/dashboard alerts.dashboard
/admin/alerts/types alerts.types
/admin/alerts/channels alerts.channels
/admin/alerts/recipients alerts.recipients

Uses web and auth middleware by default.

💡 Features

  • Create, edit, delete alert types, channels, and recipients
  • View alert logs in a searchable, filterable table
  • Filter by status (success/failure), type, channel
  • View alert detail in a modal
  • Export alert logs to CSV
  • Dark mode support

📊 Logs

Each time an alert is sent, a log is created in the alert_logs table.

🧾 Columns

Column Description
id Primary key
type Alert type name
channel Channel name (mail/telegram)
address Recipient address
bot Bot (if applicable)
subject Subject used
message Message used
details JSON-encoded extra details
status success or failure
error_message Error if status is failure
sent_at Timestamp
created_at Timestamp
updated_at Timestamp

🧱 Model

You can use the model directly for custom dashboards:

use Fantismic\AlertSystem\Models\AlertLog;

$recent = AlertLog::latest()->take(10)->get();

✅ License

MIT © Fantismic

Image description

fantismic/alert-system 适用场景与选型建议

fantismic/alert-system 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 537 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fantismic/alert-system 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fantismic/alert-system 我们能提供哪些服务?
定制开发 / 二次开发

基于 fantismic/alert-system 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 537
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-07