beyondcode/laravel-query-detector
Detect N+1 database queries in Laravel during development. Monitors queries in real time and alerts you when repeated queries indicate missing eager loading, helping you optimize performance and reduce unnecessary database calls.
Performance Optimization for High-Impact Features:
Post::morphTo(), Order::hasManyThrough()) where eager loading is frequently overlooked.Developer Productivity Initiatives:
User::with('posts')->get() slow?") via real-time feedback, cutting ramp-up time by ~30%.Cost and Scalability Roadmap:
Technical Debt Mitigation:
Cross-Team Collaboration:
Adopt if:
Look elsewhere if:
*"This is a no-code, high-impact way to cut database costs and improve scalability without hiring more engineers. By automatically detecting N+1 query patterns during development, we’ll:
It’s a 5-minute install, zero runtime overhead, and pay-as-you-go—only active in development. Let’s pilot it on our [highest-traffic feature] and measure the impact."*
*"This solves two critical problems:
Key benefits:
Proposal: Let’s enable this for all new features and legacy codebases where we’ve seen query spikes. I’ll show you a before/after on [Endpoint Y] next sprint."*
*"Tired of ‘why is this endpoint slow?’ mysteries? This package automatically detects N+1 queries and tells you exactly what to fix:
How it works:
composer require beyondcode/laravel-query-detector --dev).foreach ($users as $user) { $user->posts }).Example fix:
// Before (N+1):
$users = User::all();
foreach ($users as $user) {
echo $user->posts->count(); // 🚨 N+1 query!
}
// After (fixed):
$users = User::with('posts')->get(); // ✅ 1 query
Let’s enable this for [Project Z]—it’ll save us hours of debugging."*
How can I help you explore Laravel packages today?