Download the PHP package youngmayor/laravel-query-lens without Composer
On this page you can find all versions of the php package youngmayor/laravel-query-lens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download youngmayor/laravel-query-lens
More information about youngmayor/laravel-query-lens
Files in youngmayor/laravel-query-lens
Package laravel-query-lens
Short Description A premium database query and performance developer dashboard for Laravel API endpoints.
License MIT
Homepage https://github.com/YoungMayor/laravel-query-lens
Informations about the package laravel-query-lens
Laravel Query Lens
Laravel Query Lens is a developer dashboard and CLI performance inspector for your Laravel database queries. It tracks query counts, duplicate SQL queries (N+1 detector), cache hit/miss ratio, memory footprint, and HTTP status codes per route. It also features a premium dark-mode Blade dashboard with a built-in SQL EXPLAIN query inspector.
Features
- ⚡ Zero-dependency dashboard: Pure Blade, Vanilla JS, and custom CSS (no Livewire or Flux required on the host application).
- 🔍 N+1 and Duplicate Query Detection: Tracks duplicate execution counts to highlight redundant DB hits.
- ⚙️ Performance Metrics: Measures execution duration, peak memory usage, and cache hit/miss ratio.
- 📋 Built-in EXPLAIN Tool: Run
EXPLAINquery analyzer directly from the dashboard modal. - 💻 CLI Console Report: Summarize endpoint performance metrics right from your terminal.
- 🛠️ Configurable Storage: Choose between an isolated SQLite database or your host application's existing database.
Installation
Install the package via Composer:
Publish the package configuration:
This will create a config/laravel-query-lens.php configuration file in your host application.
Setup & Configuration
The package automatically registers its tracking middleware globally. You do not need to register it manually.
You can configure which routes are monitored by updating the paths array in config/laravel-query-lens.php. By default, only routes matching api/* are tracked:
Configure Database Storage
By default, the package registers a dynamic SQLite connection named query_lens and stores logs in database/query_reporter.sqlite.
If you prefer to store metrics in your existing application database (e.g., MySQL or PostgreSQL), set the use_configured_database option to your connection name in config/laravel-query-lens.php:
Usage
📊 Local Dashboard
The dashboard is accessible only in local and testing environments at /query-reporter (configurable via path in the config file).
🖥️ CLI Commands
Pre-load your monitored API endpoints into the database:
Display endpoint stats in the terminal:
Options:
--branch=: Filter records by Git branch.--sort=: Sort table results byqueries(default),runs,duplicates, orduration.
Testing
Credits
- Aghogho Meyoron
- All Contributors
License
The MIT License (MIT). Please see License File for more information.