PHPackages                             webmavens/debug-monitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. webmavens/debug-monitor

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

webmavens/debug-monitor
=======================

Laravel debug / data rule monitoring package

0.1(1mo ago)02↓50%[1 issues](https://github.com/webmavens/laravel-debug/issues)MITBladePHP ^8.2

Since Jun 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/webmavens/laravel-debug)[ Packagist](https://packagist.org/packages/webmavens/debug-monitor)[ RSS](/packages/webmavens-debug-monitor/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

🧠 Laravel Debug Monitor
=======================

[](#-laravel-debug-monitor)

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
----------

[](#-features)

- 🔍 Define SQL-based **debug rules** directly from the web UI
- 📁 Ship **version-controlled rule files** and sync them into the database (migration-style)
- 🕒 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
--------------

[](#-installation)

Require the package via Composer:

```
composer require webmavens/debug-monitor
```

OR

```
composer require webmavens/debug-monitor:@dev
```

⚙️ Publishing Configuration, Views &amp; Provider
-------------------------------------------------

[](#️-publishing-configuration-views--provider)

### Publish configuration:

[](#publish-configuration)

```
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=config
```

### Publish views:

[](#publish-views)

```
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=views
```

### Publish migrations

[](#publish-migrations)

```
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=migrations
```

#### Run the migrations:

[](#run-the-migrations)

```
php artisan migrate
```

🔑 Authentication
----------------

[](#-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=true` keeps the dashboard open in local.
- `DEBUG_MONITOR_ALLOWED_EMAILS` is a comma-separated allowlist used when `APP_ENV` is not `local`.

You do not need to publish or register a custom provider for the default access behavior.

🧭 Usage
-------

[](#-usage)

### 🖥️ Web Dashboard

[](#️-web-dashboard)

Visit `/debug-monitor/rules` to:

- View all rules
- Create new rules
- Edit or delete rules
- Suppress temporarily
- Review logs

### ⚡ Run Scheduler

[](#-run-scheduler)

```
php artisan schedule:work

```

### ⚡ Run Manually

[](#-run-manually)

Run all active rules manually via Artisan:

```
php artisan debug-monitor:run

```

### 🧹 Log Cleanup (Automatic Maintenance)

[](#-log-cleanup-automatic-maintenance)

Old logs can be automatically deleted using the built-in cleanup command.

#### Run Manually:

[](#run-manually)

```
php artisan debug-monitor:clean
or
php artisan debug-monitor:clean --days=7

```

#### Configure Retention Period:

[](#configure-retention-period)

In `config/debug-monitor.php`:

```
'log_retention_days' => env('DEBUG_MONITOR_LOG_RETENTION_DAYS', 30),

```

### 📁 Version-Controlled Rule Files (Sync to DB)

[](#-version-controlled-rule-files-sync-to-db)

Rules can also live as **version-controlled JSON files** that are synced into the database. Rules always **execute from the database** — files are never run directly. Each file stays linked to its database rule (with a content checksum), so the two can be kept in step:

- **Sync** applies new files and **updates changed files** (detected by checksum).
- If a database rule with the same name already exists and isn't linked to the file, the file is **skipped** (**the database wins**).
- **Editing a linked rule in the UI rewrites its file** on disk.
- **Exporting** a UI-created rule turns it into a linked file.
- **Deleting** a linked rule removes its file too.

Publish the rules directory (creates `debug-monitor-rules/` with an example):

```
php artisan vendor:publish --provider="Webmavens\DebugMonitor\DebugMonitorServiceProvider" --tag=debug-monitor-rules
```

You can author files two ways: **write them by hand**, or **build a rule in the UI and export it** (the "Export" action on a rule, or `php artisan debug-monitor:export`).

A rule file, e.g. `debug-monitor-rules/missing-user-emails.json`:

```
{
    "name": "Users missing email",
    "sql_query": "SELECT * FROM users WHERE email IS NULL",
    "frequency_minutes": 15,
    "importance_level": "high",
    "expected_rows_operator": "=",
    "expected_rows": 0,
    "expected_json": null,
    "notification_level": "default",
    "status": "active"
}
```

Import pending files into the database using the **"Sync from files"** button on `/debug-monitor/rules` (it shows how many files are pending), or via Artisan (ideal for deploy pipelines):

```
php artisan debug-monitor:sync      # apply new + changed files
php artisan debug-monitor:export    # export DB rules to files (--id=1 --id=2 for specific rules)
```

The directory is configurable in `config/debug-monitor.php`:

```
'rules_path' => env('DEBUG_MONITOR_RULES_PATH', base_path('debug-monitor-rules')),
```

🛡️ Query Safety &amp; Reliability
---------------------------------

[](#️-query-safety--reliability)

Rules run against your database, so execution is guarded for safety and to stay reliable on large / complex queries:

- **Read-only only** — a rule must be a single `SELECT` / `WITH` / `SHOW` / `EXPLAIN` statement. Anything that could mutate data or stack a second statement is rejected.
- **Streamed, not buffered** — results are streamed and counted, so a query returning millions of rows won't exhaust memory. Only a bounded sample (`max_rows`) is kept for logs and JSON matching; the row count is always exact.
- **Per-statement timeout** — a runaway query aborts instead of hanging the run (MySQL/MariaDB and PostgreSQL).
- **Non-overlapping schedule** — a slow run won't stack on top of the next one.

Configure via `.env` / `config/debug-monitor.php`:

```
DEBUG_MONITOR_READ_ONLY=true   # enforce read-only single-statement rules
DEBUG_MONITOR_QUERY_TIMEOUT=30 # per-query timeout in seconds (0 = off)
DEBUG_MONITOR_MAX_ROWS=1000    # cap on rows sampled/stored per run

```

Alerts are queued (`ShouldQueue`), so run a queue worker for them to send: `php artisan queue:work`.

🧰 Example Debug Rule
--------------------

[](#-example-debug-rule)

You can define rules such as:

NameSQL QueryFrequencyExpected RowsMissing Users`SELECT * FROM users WHERE email IS NULL`15 minutes0Stuck Orders`SELECT * FROM orders WHERE status='pending' AND created_at < NOW() - INTERVAL 2 HOUR`10 minutes0When a rule fails (unexpected result), the system:

- Logs it in the `debug_rule_logs` table
- Updates its last run time
- Sends an alert (if notifications are enabled)

### 📬 Notifications

[](#-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
-------

[](#support)

For any issues, feel free to create an issue in the [GitHub repository](https://github.com/webmavens/laravel-debug).

🤝 Contributing
--------------

[](#-contributing)

Pull requests are welcome! If you’d like to improve or extend this package, please fork the repo and create a PR.

🧠 License
---------

[](#-license)

This package is open-source software licensed under the MIT license.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance92

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/66283568?v=4)[Web Mavens](/maintainers/webmavens)[@webmavens](https://github.com/webmavens)

---

Top Contributors

[![Amit-Webmavens](https://avatars.githubusercontent.com/u/121440303?v=4)](https://github.com/Amit-Webmavens "Amit-Webmavens (12 commits)")[![webmavensteam](https://avatars.githubusercontent.com/u/66576112?v=4)](https://github.com/webmavensteam "webmavensteam (5 commits)")[![sawan-webmavens](https://avatars.githubusercontent.com/u/456840?v=4)](https://github.com/sawan-webmavens "sawan-webmavens (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/webmavens-debug-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/webmavens-debug-monitor/health.svg)](https://phpackages.com/packages/webmavens-debug-monitor)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M353](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k30.2M156](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M206](/packages/laravel-mcp)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
