Download the PHP package gladehq/laravel-query-lens without Composer
On this page you can find all versions of the php package gladehq/laravel-query-lens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gladehq/laravel-query-lens
More information about gladehq/laravel-query-lens
Files in gladehq/laravel-query-lens
Package laravel-query-lens
Short Description A Laravel package for analyzing and optimizing database queries with performance insights
License MIT
Informations about the package laravel-query-lens
QueryLens
The self-hosted query performance platform for Laravel -- with AI-powered optimization, automated index recommendations, and CI pipeline regression detection.
Why QueryLens
- Self-hosted. Your query data never leaves your servers. No external SaaS dependency, no data privacy concerns.
- Query-focused. Not another broad monitoring tool. QueryLens is purpose-built for database query performance -- EXPLAIN analysis, index recommendations, regression detection, and AI optimization.
- Production-ready. Configurable sampling rate, Octane-safe architecture, Laravel Gate authentication, and per-request isolation. Designed for high-traffic applications.
- Actionable. Every feature produces a concrete next step -- an index to create, a query to rewrite, a regression to investigate. Not just dashboards.
- 100% free and open-source. Every feature is available to everyone.
How QueryLens Compares
All features included. No paid tiers. MIT licensed. Community-driven.
| Feature | QueryLens | Debugbar | Telescope | Pulse | Nightwatch |
|---|---|---|---|---|---|
| Deployment | Self-hosted | Self-hosted | Self-hosted | Self-hosted | Cloud |
| Price | Free | Free | Free | Free | Subscription |
| EXPLAIN Analysis | Deep + human-readable | No | No | No | No |
| Index Recommendations | Automated | No | No | No | No |
| Regression Detection | CI-integrated | No | No | No | Limited |
| AI Query Optimization | OpenAI-compatible | No | No | No | No |
| Transaction Tracking | Full lifecycle | No | Yes | No | No |
| Filament Plugin | Native panel integration | No | No | No | No |
| Request Sampling | Configurable rate | No | Yes | Yes | N/A |
| Alerting | Log, Mail, Slack | No | No | No | Yes |
| N+1 Detection | Automatic | Yes | Yes | No | No |
| Code Origin Tracing | File + line number | Yes | Yes | No | No |
| Request Waterfall | Visual timeline | Yes | No | No | No |
Features
Dashboard Overview
Real-time query monitoring dashboard with stats overview, query list, and performance ratings. Supports live polling, search, and filtering by query type, duration, and slow status.
EXPLAIN Analysis with Human-Readable Output
Run EXPLAIN on any captured query directly from the dashboard. Results are parsed into human-readable descriptions explaining what the database engine is doing -- table scans, index usage, join strategies, and row estimates.
Index Recommendation Engine
Analyzes query patterns over configurable time windows and recommends specific indexes to create. Outputs ready-to-run CREATE INDEX statements with impact estimates based on actual query frequency and duration.
Query Regression Detection and CI Integration
Compare query performance between time periods to detect regressions. Integrates with CI/CD pipelines via the query-lens:check-regression command. Supports webhook notifications for automated alerting when performance degrades.
AI-Powered Query Optimization
Submit slow queries to any OpenAI-compatible API for optimization suggestions. Returns rewritten SQL, explanation of changes, and estimated performance improvement. Results are cached to avoid redundant API calls.
Transaction Tracking
Track database transaction lifecycle -- begin, commit, rollback events with duration, nesting depth, and query count. Associates queries with their enclosing transaction for debugging deadlocks and long-running transactions.
Filament Panel Integration
Native Filament v3 plugin with real pages, Table Builder, Chart Widgets, and Stats Overview. Register with a single line in your panel configuration. Works alongside the standalone dashboard.
Request Waterfall Visualization
Visual timeline of all queries within a single HTTP request, showing execution order, duration bars, and overlap detection. Identifies sequential queries that could be parallelized.
Performance Trend Tracking
Track P50, P95, and P99 latency over time with configurable granularity (hourly or daily). Identify slow degradation patterns before they become incidents. Top queries ranked by total impact (frequency multiplied by duration).
Quick Start
1. Install the package
2. Publish configuration and migrations
3. Run migrations
4. Enable in your environment
5. Visit the dashboard
Open /query-lens in your browser.
Configuration
The configuration file is published to config/query-lens.php. Key options:
Storage Driver
- cache -- Ephemeral storage using Laravel's cache. No persistence across restarts. Good for development.
- database -- Persistent storage with full query history, aggregation, and trend tracking. Required for production features like regression detection and index recommendations.
Sampling Rate
Controls what fraction of requests have their queries recorded. 1.0 records every request. 0.1 records 10%. The decision is made once per request so all queries within a sampled request are captured together.
Authentication
By default, the dashboard is restricted to localhost. For production, configure a Laravel Gate:
AI Provider Setup
Works with any OpenAI-compatible API endpoint. AI features are entirely optional -- the package is fully functional without them.
Transaction Tracking
Alert Channels
Artisan Commands
query-lens:aggregate
Pre-calculates hourly and daily performance aggregates for trend charts and top query rankings. Schedule this to run hourly in your app/Console/Kernel.php:
query-lens:prune
Cleans up old query data based on the configured retention period. Schedule daily:
query-lens:suggest-indexes
Analyzes recorded query patterns and recommends database indexes:
query-lens:check-regression
Detects query performance regressions by comparing current period against the previous period. Designed for CI/CD pipelines:
Returns exit code 1 when regressions are detected, making it suitable for CI pipeline gates.
Filament Integration
QueryLens includes a native Filament v3 plugin. Filament is optional -- the package works without it.
Register the plugin
Customize
The plugin provides:
- Dashboard -- Stats overview widget, query table with search/filter/sort, View and Explain actions
- Alerts -- CRUD management for alert rules with modal forms
- Trends -- Performance and volume chart widgets, top queries table with period selector
Requirements
- PHP 8.1+
- Laravel 10.x, 11.x, or 12.x
- Filament 3.x (optional, for panel integration)
Documentation
Read complete documentation at Documentation.
Contributing
Contributions are welcome. Please submit pull requests against the master branch. Run the test suite before submitting:
License
The MIT License (MIT). See LICENSE for details.
Credits
Developed by Dulitha Rajapaksha for GladeHQ.
All versions of laravel-query-lens with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.2
illuminate/http Version ^9.0|^10.0|^11.0|^12.0