PHPackages                             atmos/laravel-db-sentinel - 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. [Database &amp; ORM](/categories/database)
4. /
5. atmos/laravel-db-sentinel

ActiveLibrary[Database &amp; ORM](/categories/database)

atmos/laravel-db-sentinel
=========================

Smart database query monitoring and optimization tool for Laravel 7+.

v1.0.0-beta.1(2mo ago)01MITPHPPHP ^7.0|^8.0

Since Mar 1Pushed 2mo agoCompare

[ Source](https://github.com/tushar-kadus/laravel-db-sentinel)[ Packagist](https://packagist.org/packages/atmos/laravel-db-sentinel)[ Docs](https://github.com/tushar-kadus/laravel-db-sentinel)[ RSS](/packages/atmos-laravel-db-sentinel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

DB Sentinel for Laravel
=======================

[](#db-sentinel-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec9f75014aea2c646327dacbd86e46b50cefa4a5ac1d78dc9f9820dc979d87ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61746d6f732f6c61726176656c2d64622d73656e74696e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/atmos/laravel-db-sentinel)[![Total Downloads](https://camo.githubusercontent.com/e2d5f517995d37714e422acf2247ea726237bb7543eb1cae200a12bf474430d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61746d6f732f6c61726176656c2d64622d73656e74696e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/atmos/laravel-db-sentinel)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

**Laravel DB Sentinel** is a smart database query monitoring and optimization tool for Laravel 7+. It helps Laravel applications track, analyze and optimize database behavior with insights on slow or inefficient queries and actionable performance feedback.

> **⚠️ Beta Version**
> **This package is currently in Beta.** Expect frequent updates and potential breaking changes until we reach version 1.0.0. Please report any issues or bugs on the GitHub repository.

✨ Features
----------

[](#-features)

- 📊 **Quick Dashboard** — A clean UI to visualize your database status.
- 🔍 **Query Monitoring** — Automatically capture and log all database queries executed by your application.
- 🐢 **Slow Query Detection** — Highlight queries that exceed a configurable execution threshold.
- 📈 **Performance Insights** — Collect statistics like query counts, total time spent, and slow query summaries.
- 🧪 **Developer-Friendly Output** — Easy logs or debug output to help you optimize during development.
- 🛡️ **Built-in Authorization:** — Restrict access to specific users via User IDs.
- ⚙️ **Configurable &amp; Lightweight** — Enable or disable features via config — no performance impact in production.

📦 Installation
--------------

[](#-installation)

Install **Laravel DB Sentinel** via Composer:

```
composer require atmos/laravel-db-sentinel
```

### ⚠️ Important: Run Migrations

[](#️-important-run-migrations)

After installing the package, you must run:

```
php artisan migrate
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

This package supports Laravel's package auto-discovery, so no manual registration is required.

If auto-discovery is disabled, manually register the service provider in `config/app.php`:

```
'providers' => [
    Atmos\DbSentinel\DbSentinelServiceProvider::class,
],
```

🔧 Publishing Package Resources
------------------------------

[](#-publishing-package-resources)

Laravel DB Sentinel allows you to publish its resources so you can customize them inside your application.

### 📄 Publish Configuration File

[](#-publish-configuration-file)

Publish the configuration file to `config/db-sentinel.php`:

```
php artisan vendor:publish --tag=db-sentinel-config
```

---

### 🎨 Publish View Files

[](#-publish-view-files)

If the package provides Blade views, publish them with:

```
php artisan vendor:publish --tag=db-sentinel-views
```

Published views will be located in:

```
resources/views/vendor/db-sentinel/

```

You can safely modify these views without affecting the core package.

---

> 💡 Tip: You can run `php artisan vendor:publish` without arguments to interactively choose which resources to publish.

⚙️ Configuration
----------------

[](#️-configuration)

DB Sentinel is designed to work out of the box, but you can customize its behavior using the following environment variables in your `.env` file.

### 🔌 General &amp; Storage

[](#-general--storage)

VariableDescriptionDefault`DB_SENTINEL_ENABLED`Toggle the entire monitoring system.`true``DB_SENTINEL_CONNECTION`DB connection to store the DB Sentinel logs (e.g., `mysql`).Your application's default database connection`DB_SENTINEL_LOGS_TABLE`The name of the table for stored logs.`sentinel_logs``DB_SENTINEL_PRUNE_DAYS`Auto-delete logs older than X days.`30``DB_SENTINEL_SCHEDULE_ENABLED`Auto-schedule pruning command.`true`### ⚡ Performance &amp; Scope

[](#-performance--scope)

VariableDescriptionDefault`DB_SENTINEL_QUEUE_NAME`Queue for background analysis jobs.`default``DB_SENTINEL_ALLOWED_CONS`Connections to monitor (comma-separated).`mysql,mariadb,pgsql,sqlsrv``DB_SENTINEL_IGNORED_CONS`Connections to skip (comma-separated).`sqlite,testing`### 🖥️ Dashboard &amp; Security

[](#️-dashboard--security)

VariableDescriptionDefault`DB_SENTINEL_DASHBOARD`Enable or disable the Web UI.`true``DB_SENTINEL_PATH`The URL slug to access the dashboard.`db-sentinel``DB_SENTINEL_USER_IDS`Authorized User IDs (comma-separated).*(empty)*---

### 📝 Example .env Setup

[](#-example-env-setup)

```
# Core Settings
DB_SENTINEL_ENABLED=true
DB_SENTINEL_PRUNE_DAYS=14
DB_SENTINEL_SCHEDULE_ENABLED=true

# Storage & Connection
DB_SENTINEL_LOGS_TABLE=custom_sentinel_logs
DB_SENTINEL_CONNECTION=mysql

# Dashboard Access
DB_SENTINEL_PATH=admin/db-metrics
DB_SENTINEL_USER_IDS=1,25
```

### ⚠️ Important Logic &amp; Security Notes

[](#️-important-logic--security-notes)

#### 🔄 Connection Precedence

[](#-connection-precedence)

When configuring your monitoring scope, please note the following hierarchy:

- **`DB_SENTINEL_IGNORED_CONS` always takes precedence.**
- If a connection is listed in **both** "allowed" and "ignored," it will be **ignored**.
- Ensure your primary connection is not accidentally added to the ignored list.

#### 🔒 Dashboard Access

[](#-dashboard-access)

Caution

**Be cautious when setting `DB_SENTINEL_USER_IDS`.**This variable controls who can view your database performance metrics and raw SQL queries.

- Ensure you only input the **numeric IDs** of trusted administrators.
- If left empty while `DB_SENTINEL_DASHBOARD` is `true`, access will depend solely on your `auth` middleware, which may be too permissive depending on your app's setup.

### 🧹 Pruning

[](#-pruning)

#### Auto-Pruning

[](#auto-pruning)

By default, DB Sentinel schedules a daily cleanup of old logs.

##### Configuration

[](#configuration)

You can control this behavior in your `.env`:

```
# How many days to keep logs
DB_SENTINEL_PRUNE_DAYS=30

# Enable/Disable the automatic daily background task
DB_SENTINEL_SCHEDULE_ENABLED=true
```

Tip

If you set DB\_SENTINEL\_SCHEDULE\_ENABLED=false, the package will not register the task. You can then manually add php artisan db-sentinel:prune to your own Scheduler at a specific time that suits your server load.

#### 🧹 Manual Pruning

[](#-manual-pruning)

If you want to clear old logs immediately without waiting for the automated scheduler, you can run the built-in Artisan command.

##### Usage

[](#usage)

Run the following command in your terminal:

```
php artisan db-sentinel:prune
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance86

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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

72d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38?v=4)[Corey Donohoe](/maintainers/atmos)[@atmos](https://github.com/atmos)

---

Top Contributors

[![atmos-ion](https://avatars.githubusercontent.com/u/117018601?v=4)](https://github.com/atmos-ion "atmos-ion (7 commits)")[![tushar-kadus](https://avatars.githubusercontent.com/u/117018601?v=4)](https://github.com/tushar-kadus "tushar-kadus (7 commits)")

---

Tags

laraveldatabaseperformanceoptimizationquery-monitorsql-analyzer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/atmos-laravel-db-sentinel/health.svg)

```
[![Health](https://phpackages.com/badges/atmos-laravel-db-sentinel/health.svg)](https://phpackages.com/packages/atmos-laravel-db-sentinel)
```

###  Alternatives

[sarfraznawaz2005/indexer

Laravel package to monitor SELECT queries and offer best possible INDEX fields.

562.7k](/packages/sarfraznawaz2005-indexer)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)

PHPackages © 2026

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