QueryLens is a modern, lightweight, and high-performance API debugging and SQL profiling tool for Laravel. It provides a real-time dashboard to monitor your application's database activity and API performance without unnecessary complexity.
- ⚡ Zero-Configuration Setup
- 🛠 Deep SQL Query Profiling
- 📊 Real-Time Request Monitoring
- 🧠 Query Execution Time Analysis
- 🎨 Modern Dark UI Dashboard
- 📦 Dedicated SQLite Storage
- 🚀 Lightweight & Fast
- 🔥 Slow Query Detection
- 📱 Mobile Responsive Interface
- 🔍 Request & Response Inspection
| Requirement | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^10.0 | ^11.0 | ^12.0 |
Install the package via Composer:
composer require mr-sabya/querylensRun the installation command:
php artisan querylens:installThis command will:
- Publish configuration files
- Create QueryLens storage
- Prepare SQLite logging database
- Register required assets
After installation, configure QueryLens from:
config/querylens.php
Example configuration:
<?php
return [
/*
|--------------------------------------------------------------------------
| Enable QueryLens
|--------------------------------------------------------------------------
*/
'enabled' => env('QUERYLENS_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Dashboard URI
|--------------------------------------------------------------------------
*/
'uri' => 'querylens',
/*
|--------------------------------------------------------------------------
| Slow Query Threshold (milliseconds)
|--------------------------------------------------------------------------
*/
'slow_query_threshold' => 500,
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
*/
'middleware' => [
'web',
// 'auth',
],
/*
|--------------------------------------------------------------------------
| Maximum Stored Logs
|--------------------------------------------------------------------------
*/
'max_logs' => 5000,
];Start your Laravel application:
php artisan serveOpen the dashboard in your browser:
http://127.0.0.1:8000/querylens
QueryLens will automatically record:
- HTTP Requests
- API Calls
- SQL Queries
- Query Bindings
- Response Time
- Memory Usage
- Slow Queries
- Request Timeline
The dashboard includes:
- HTTP Method
- Route Path
- Response Status
- Request Duration
- Raw SQL Query
- Query Bindings
- Execution Time
- Source File & Line
- Memory Consumption
- Slow Query Alerts
- Duplicate Query Detection
Queries slower than the configured threshold will automatically be highlighted.
Example:
⚠ Slow Query Detected (842ms)
QueryLens uses a dedicated SQLite database for storing logs.
This keeps your primary application database clean and optimized.
QueryLens is intended for local and development environments.
Disable it in production:
QUERYLENS_ENABLED=falseYou may also protect the dashboard using authentication middleware:
'middleware' => [
'web',
'auth',
],select * from users where email = ?Execution details:
Duration: 12ms
Connection: mysql
Memory: 4MB
src/
├── Commands/
├── Facades/
├── Http/
│ ├── Controllers/
│ └── Middleware/
├── Listeners/
├── Models/
├── Providers/
├── Services/
├── Support/
├── resources/
│ ├── views/
│ ├── js/
│ └── css/
└── config/
- Live AJAX Auto Refresh
- Real-Time WebSocket Monitoring
- Redis Monitoring
- Queue Monitoring
- Exception Tracking
- Export Logs
- Multi-Project Support
Contributions are welcome.
- Fork the repository
- Create a new feature branch
- Commit your changes
- Push your branch
- Open a Pull Request
This package is open-sourced software licensed under the MIT license.
If you find QueryLens useful, consider starring the repository on GitHub.