Download the PHP package atmos/laravel-db-sentinel without Composer
On this page you can find all versions of the php package atmos/laravel-db-sentinel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atmos/laravel-db-sentinel
More information about atmos/laravel-db-sentinel
Files in atmos/laravel-db-sentinel
Package laravel-db-sentinel
Short Description Smart database query monitoring and optimization tool for Laravel 7+.
License MIT
Homepage https://github.com/tushar-kadus/laravel-db-sentinel
Informations about the package laravel-db-sentinel
DB Sentinel for Laravel
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
- ๐ 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 & Lightweight โ Enable or disable features via config โ no performance impact in production.
๐ฆ Installation
Install Laravel DB Sentinel via Composer:
โ ๏ธ Important: Run Migrations
After installing the package, you must run:
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:
๐ง Publishing Package Resources
Laravel DB Sentinel allows you to publish its resources so you can customize them inside your application.
๐ Publish Configuration File
Publish the configuration file to config/db-sentinel.php:
๐จ Publish View Files
If the package provides Blade views, publish them with:
Published views will be located in:
You can safely modify these views without affecting the core package.
๐ก Tip: You can run
php artisan vendor:publishwithout arguments to interactively choose which resources to publish.
โ๏ธ 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 & Storage
| Variable | Description | Default |
|---|---|---|
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 & Scope
| Variable | Description | Default |
|---|---|---|
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 & Security
| Variable | Description | Default |
|---|---|---|
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
โ ๏ธ Important Logic & Security Notes
๐ Connection Precedence
When configuring your monitoring scope, please note the following hierarchy:
DB_SENTINEL_IGNORED_CONSalways 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
[!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_DASHBOARDistrue, access will depend solely on yourauthmiddleware, which may be too permissive depending on your app's setup.
๐งน Pruning
Auto-Pruning
By default, DB Sentinel schedules a daily cleanup of old logs.
Configuration
You can control this behavior in your .env:
[!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
If you want to clear old logs immediately without waiting for the automated scheduler, you can run the built-in Artisan command.
Usage
Run the following command in your terminal:
All versions of laravel-db-sentinel with dependencies
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/pipeline Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/bus Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/queue Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0