定制 sararzbn/queryspy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sararzbn/queryspy

最新稳定版本:v1.1.2

Composer 安装命令:

composer require sararzbn/queryspy

包简介

Laravel profiler for slow queries with smart suggestions

README 文档

README

QuerySpy is a developer-friendly profiler for Laravel that captures slow SQL queries and suggests optimizations.

🚀 Features

  • Logs all slow database queries
  • Clean dashboard with filters and search
  • Smart suggestions (e.g. avoid SELECT *, use WHERE, add LIMIT)
  • CLI commands to export or clear query logs
  • Works out of the box with zero config
  • 100% test coverage

📦 Installation

To install the package, simply run the following Composer command:

composer require sararzbn/queryspy

⚙️ Configuration (optional)

php artisan vendor:publish --tag=queryspy-config

(Only needed if config publishing is supported)

🗄️ Database Migration

QuerySpy stores slow queries in a dedicated database table. To create it, run:

php artisan migrate

🖥️ Usage

Dashboard

Open in browser:

http://localhost:8000/queryspy

Trigger a slow query manually (for testing)

\DB::table('users')->whereRaw('pg_sleep(1)')->get();

pg_sleep(1) causes a delay on PostgreSQL.

🛠️ CLI Commands

Export queries:

php artisan queryspy:export --format=csv
php artisan queryspy:export --format=json

Clear the log file:

php artisan queryspy:clear

🧩 Roadmap

  • Live dashboard updates (AJAX polling)
  • Tag queries with request/user context
  • JOIN performance analyzer

👩‍💻 Author

Created with ❤️ by Sara Rouzbahani

📄 License

MIT License

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-21