sambukhari/laravel-exception-alert
Composer 安装命令:
composer require sambukhari/laravel-exception-alert
包简介
Send Laravel exception details directly to your email with simple config toggles.
README 文档
README
A lightweight, safe and professional Laravel package that sends exception details to a developer email.
Designed to be non-intrusive: it uses a trait, provides a one-time installer for Handler integration, publishes config and views, and includes safe uninstall/rollback.
Key features
- Trait-based alerting to avoid method collisions with projects that already override
report(). - One-time installer command
php artisan exception-alert:install— no runtime injection. - Publishes config and email view for customization.
- Test command to send a sample alert.
- Uninstall/restore command to safely remove changes.
- Idempotent and creates backups before modifying
app/Exceptions/Handler.php.
Requirements
- PHP >= 8.0
- Laravel 8 / 9 / 10 / 11 (or compatible)
- Proper mail configuration in your
.env(SMTP, Mailgun, SES, etc.)
Installation (step-by-step)
-
Require the package
If the package is on Packagist:
composer require sambukhari/laravel-exception-alert
If you are installing from your GitHub repository (recommended for testing before publishing):
- Add repository entry to your app
composer.json(optional):"repositories": [ { "type": "vcs", "url": "https://github.com/sambukhari/laravel-exception-alert" } ]
- Then require the package:
composer require sambukhari/laravel-exception-alert:dev-main --prefer-source
- Add repository entry to your app
-
Run the one-time installer:
php artisan exception-alert:install
- Publishes
config/exception-alert.phpandresources/views/vendor/exception-alert. - Injects the trait into
app/Exceptions/Handler.php. - Creates a timestamped backup.
- Publishes
-
Set your recipient email in
.env:EXCEPTION_ALERT_EMAIL=developer@example.com EXCEPTION_ALERT_ENABLED=true
-
Test email:
php artisan exception-alert:test
-
Clear caches:
php artisan optimize:clear composer dump-autoload -o
Configuration
return [ 'enabled' => env('EXCEPTION_ALERT_ENABLED', true), 'to' => env('EXCEPTION_ALERT_EMAIL', null), 'exceptions' => [ 400 => true, 404 => false, 500 => true, ], ];
Commands
| Command | Description |
|---|---|
php artisan exception-alert:install |
Install and inject trait |
php artisan exception-alert:test |
Send test alert email |
php artisan exception-alert:uninstall |
Remove injected trait |
Uninstall / Rollback
php artisan exception-alert:uninstall composer remove sambukhari/laravel-exception-alert
Contributing
- Fork this repo
- Create feature branch
- Submit PR
License
This project is open-sourced under the MIT License.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-16