PHPackages                             youngmayor/laravel-query-lens - 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. youngmayor/laravel-query-lens

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

youngmayor/laravel-query-lens
=============================

A premium database query and performance developer dashboard for Laravel API endpoints.

v0.1.3(1mo ago)030↓87.5%MITBladePHP ^8.0

Since Jun 6Pushed 1mo agoCompare

[ Source](https://github.com/YoungMayor/laravel-query-lens)[ Packagist](https://packagist.org/packages/youngmayor/laravel-query-lens)[ Docs](https://github.com/YoungMayor/laravel-query-lens)[ RSS](/packages/youngmayor-laravel-query-lens/feed)WikiDiscussions main Synced 1w ago

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

Laravel Query Lens
==================

[](#laravel-query-lens)

[![Latest Version on Packagist](https://camo.githubusercontent.com/635d0817d9f27ddbd824b8213a35f2d73b449bcd92b7f51c3dc5c50bad5a1557/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f756e676d61796f722f6c61726176656c2d71756572792d6c656e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/youngmayor/laravel-query-lens)[![Total Downloads](https://camo.githubusercontent.com/e03808b5350a764dcf3110e69d0f449d370ca35fbaadd5dbe2aa39e9bb1b6bd7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796f756e676d61796f722f6c61726176656c2d71756572792d6c656e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/youngmayor/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
--------

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

[](#installation)

Install the package via Composer:

```
composer require youngmayor/laravel-query-lens
```

Publish the package configuration:

```
php artisan vendor:publish --provider="Youngmayor\LaravelQueryLens\LaravelQueryLensServiceProvider" --tag="config"
```

This will create a `config/laravel-query-lens.php` configuration file in your host application.

---

Setup &amp; Configuration
-------------------------

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

```
'paths' => [
    'api/*', // Wildcards are supported
],
```

### Configure Database Storage

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

```
'use_configured_database' => 'mysql', // Uses your default 'mysql' connection instead of SQLite
```

---

Usage
-----

[](#usage)

### 📊 Local Dashboard

[](#-local-dashboard)

The dashboard is accessible only in `local` and `testing` environments at `/query-reporter` (configurable via `path` in the config file).

### 🖥️ CLI Commands

[](#️-cli-commands)

Pre-load your monitored API endpoints into the database:

```
php artisan report:load-urls
```

Display endpoint stats in the terminal:

```
php artisan report:queries
```

Options:

- `--branch=`: Filter records by Git branch.
- `--sort=`: Sort table results by `queries` (default), `runs`, `duplicates`, or `duration`.

---

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Aghogho Meyoron](https://github.com/YoungMayor)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

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

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47315212?v=4)[Aghogho Meyoron](/maintainers/YoungMayor)[@YoungMayor](https://github.com/YoungMayor)

---

Top Contributors

[![YoungMayor](https://avatars.githubusercontent.com/u/47315212?v=4)](https://github.com/YoungMayor "YoungMayor (5 commits)")

---

Tags

laravelprofilerdatabaseperformancequerydashboardexplainyoungmayor

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/youngmayor-laravel-query-lens/health.svg)

```
[![Health](https://phpackages.com/badges/youngmayor-laravel-query-lens/health.svg)](https://phpackages.com/packages/youngmayor-laravel-query-lens)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M12.2k](/packages/illuminate-database)[illuminated/db-profiler

Database Profiler for Laravel Web and Console Applications.

169242.5k](/packages/illuminated-db-profiler)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

463.0k](/packages/itpathsolutions-dbstan)[muhdfaiz/laravel-tail-db

Provide artisan command to monitor realtime database query executed from the application. Able to automatically run explain command for each of query received.

5827.2k](/packages/muhdfaiz-laravel-tail-db)[sarfraznawaz2005/indexer

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

562.7k](/packages/sarfraznawaz2005-indexer)

PHPackages © 2026

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