Ever wonder “What database queries is my app running right now?” When slow performance strikes, digging through code is painful. That’s why I built Lens a tiny package that logs every SQL query with timing, parameters, and a simple UI.
What Lens does:
- Logs every DB query in your app (includes timing, bindings, and stack trace)
- Clean UI at
/lensfor browsing and searching queries - No setup! Just install and go!
Quick install:
composer require askerakbar/lens
Add to your module’s config:
'lens' => [
'storage' => [
'type' => 'database',
'table' => 'lens_logs', // Optional, default: lens_logs
],
],
Once your app runs, you’ll get query logs like:
SELECT * FROM products WHERE category_id = 10 (15 ms)
Lens is still in development. It’s been tested on Laminas MVC ≥3.7 + PDO_MySQL only, and is intended for only for development. It’s mostly for short-term help on existing projects, especially given Laminas MVC’s sunset status.
GitHub → https://github.com/askerakbar/lens

Top comments (0)