mhamed/laravel-slack-errors-watch
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mhamed/laravel-slack-errors-watch
包简介
Automatic Slack error reporting for Laravel applications
README 文档
README
Automatic Slack error reporting for Laravel applications. Get instant Slack notifications for every unhandled exception — zero manual setup required.
Installation
composer require mhamed/laravel-slack-errors-watch
Laravel will auto-discover the package. No need to register any service provider manually.
Configuration
1. Create a Slack Webhook URL
- Go to https://api.slack.com/apps
- Click Create New App → From scratch
- Give it a name (e.g. "Exception Bot") and select your workspace
- In the left sidebar, click Incoming Webhooks
- Toggle Activate Incoming Webhooks to On
- Click Add New Webhook to Workspace
- Select the channel where you want error reports posted and click Allow
- Copy the Webhook URL (it looks like
https://hooks.slack.com/services/T.../B.../xxxx)
2. Add the Webhook URL to .env
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../xxxx
That's it. The package will automatically report all unhandled exceptions to your Slack channel.
Optional Configuration
Publish the config file to customize behavior:
php artisan vendor:publish --tag=slack-errors-watch-config
This creates config/slack-errors-watch.php with the following options:
| Option | Default | Description |
|---|---|---|
enable_production |
true |
Send reports in production |
enable_local |
false |
Send reports in local environment |
auto_report_exceptions |
true |
Auto-register in exception handler |
ignore |
[] |
Exception classes to skip (see below) |
log_channel |
'slack' |
Logging channel name |
slack_channel_config |
(see below) | Default Slack channel config |
Ignoring Exceptions
Add exception classes to the ignore array to prevent them from being reported to Slack. It uses instanceof, so ignoring a parent class also ignores all its subclasses.
'ignore' => [ \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class, \Illuminate\Auth\AuthenticationException::class, \Illuminate\Database\Eloquent\ModelNotFoundException::class, \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException::class, ],
Default Slack Channel Config
If your app doesn't already define a slack logging channel, the package creates one automatically using slack_channel_config:
'slack_channel_config' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Exception Bot', 'emoji' => ':boom:', 'level' => 'error', ],
Usage
Automatic (default)
With auto_report_exceptions enabled, every unhandled exception is reported to Slack automatically. No code changes needed.
Manual
use Mhamed\SlackErrorsWatch\Facades\SlackErrorsWatch; // Report an exception SlackErrorsWatch::logException($exception); // Send an info message SlackErrorsWatch::slackLogInfo('Deployment completed successfully');
License
MIT
mhamed/laravel-slack-errors-watch 适用场景与选型建议
mhamed/laravel-slack-errors-watch 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 1.12k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「errors」 「exceptions」 「monitoring」 「laravel」 「slack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mhamed/laravel-slack-errors-watch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mhamed/laravel-slack-errors-watch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mhamed/laravel-slack-errors-watch 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
php7ify is a project that brings new php7 classes and exceptions to php 5.x.
The CodenamePHP Platform core that contains basic interfaces, exceptions etc..
A Symfony bundle for chameleon-system/sanitycheck
SoftWax Health Check Bundle for Symfony framework
Bootstraps errors and handles them via reporters and renderers
1Pilot client for Symfony
统计信息
- 总下载量: 1.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-13