webmavens / debug-monitor
Laravel debug / data rule monitoring package
Requires
- php: ^8.2
- illuminate/console: ^10.0 || ^11.0 || ^12.0
- illuminate/database: ^10.0 || ^11.0 || ^12.0
- illuminate/http: ^10.0 || ^11.0 || ^12.0
- illuminate/notifications: ^10.0 || ^11.0 || ^12.0
- illuminate/routing: ^10.0 || ^11.0 || ^12.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0
- illuminate/view: ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- pestphp/pest: ^3.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-06-23 10:24:30 UTC
README
A lightweight Laravel package that helps developers and administrators automatically run SQL-based health checks, detect data anomalies, and get notified when something goes wrong.
๐ Features
- ๐ Define SQL-based debug rules directly from the web UI
- ๐ Run rules automatically via scheduler or manually using an Artisan command
- ๐ Store and view detailed execution logs
- ๐งน Automatically clean old logs (configurable retention)
- โ๏ธ Send email notifications for failed rules
- โ๏ธ Supports SQLite and MySQL
- ๐ Secure access with a local-by-default gate and optional email allowlist
- ๐งฑ Easy to extend and customize
๐ฆ Installation
Require the package via Composer:
composer require webmavens/debug-monitor
โ๏ธ Publishing Configuration, Views & Provider
Publish configuration:
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=config
Publish views:
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=views
Publish migrations
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=migrations
Run the migrations:
php artisan migrate
๐ Authentication
By default, Debug Monitor is accessible in the local environment only.
Customizing Access
Set one or both of these environment values:
DEBUG_MONITOR_ALLOW_IN_LOCAL=true
DEBUG_MONITOR_ALLOWED_EMAILS=admin@example.com,dev@example.com
DEBUG_MONITOR_ALLOW_IN_LOCAL=truekeeps the dashboard open in local.DEBUG_MONITOR_ALLOWED_EMAILSis a comma-separated allowlist used whenAPP_ENVis notlocal.
You do not need to publish or register a custom provider for the default access behavior.
๐งญ Usage
๐ฅ๏ธ Web Dashboard
Visit /debug-monitor/rules to:
- View all rules
- Create new rules
- Edit or delete rules
- Suppress temporarily
- Review logs
โก Run Scheduler
php artisan schedule:work
โก Run Manually
Run all active rules manually via Artisan:
php artisan debug-monitor:run
๐งน Log Cleanup (Automatic Maintenance)
Old logs can be automatically deleted using the built-in cleanup command.
Run Manually:
php artisan debug-monitor:clean
or
php artisan debug-monitor:clean --days=7
Configure Retention Period:
In config/debug-monitor.php:
'log_retention_days' => env('DEBUG_MONITOR_LOG_RETENTION_DAYS', 30),
๐งฐ Example Debug Rule
You can define rules such as:
| Name | SQL Query | Frequency | Expected Rows |
|---|---|---|---|
| Missing Users | SELECT * FROM users WHERE email IS NULL |
15 minutes | 0 |
| Stuck Orders | SELECT * FROM orders WHERE status='pending' AND created_at < NOW() - INTERVAL 2 HOUR |
10 minutes | 0 |
When a rule fails (unexpected result), the system:
- Logs it in the
debug_rule_logstable - Updates its last run time
- Sends an alert (if notifications are enabled)
๐ฌ Notifications
Set up your mail credentials in .env and configure the email notification in your config/debug-monitor.php file:
'notify_email' => env('DEBUG_MONITOR_NOTIFY_EMAIL', 'admin@example.com'),
Failed rules will trigger an email with detailed information.
Support
For any issues, feel free to create an issue in the GitHub repository.
๐ค Contributing
Pull requests are welcome! If youโd like to improve or extend this package, please fork the repo and create a PR.
๐ง License
This package is open-source software licensed under the MIT license.