PHPackages                             furkankufrevi/laravel-slow-query-detector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. furkankufrevi/laravel-slow-query-detector

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

furkankufrevi/laravel-slow-query-detector
=========================================

Detect slow queries and N+1 problems in your Laravel app. Logs warnings with query details, execution time, and origin.

00PHPCI passing

Since Mar 16Pushed 1w agoCompare

[ Source](https://github.com/furkankufrevi/laravel-slow-query-detector)[ Packagist](https://packagist.org/packages/furkankufrevi/laravel-slow-query-detector)[ RSS](/packages/furkankufrevi-laravel-slow-query-detector/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Slow Query Detector
===========================

[](#laravel-slow-query-detector)

A lightweight Laravel package that detects slow database queries and N+1 problems, logging them with execution time and origin trace.

Installation
------------

[](#installation)

```
composer require furkankufrevi/laravel-slow-query-detector
```

The service provider is auto-discovered. To publish the config:

```
php artisan vendor:publish --tag=slow-query-detector-config
```

Setup
-----

[](#setup)

Add the middleware to your routes or groups:

```
// bootstrap/app.php (Laravel 11+)
->withMiddleware(function (Middleware $middleware) {
    $middleware->append(\SlowQueryDetector\Middleware\SlowQueryMiddleware::class);
})

// app/Http/Kernel.php (Laravel 10)
protected $middleware = [
    \SlowQueryDetector\Middleware\SlowQueryMiddleware::class,
];
```

Configuration
-------------

[](#configuration)

Set via `.env` or publish the config file:

```
SLOW_QUERY_DETECTOR_ENABLED=true
SLOW_QUERY_THRESHOLD=100
SLOW_QUERY_LOG_CHANNEL=
```

OptionDefaultDescription`enabled``true`Enable/disable the detector`threshold``100`Slow query threshold in milliseconds`detect_n_plus_one``true`Enable N+1 duplicate query detection`duplicate_threshold``3`Min repeated queries to trigger N+1 warning`log_channel``null`Log channel (null = default)`include_trace``true`Include origin stack trace in logs`trace_depth``5`Max stack frames to captureLog Output
----------

[](#log-output)

**Slow query:**

```
[Slow Query] GET /users | 250.00ms | select * from users where active = 1 | Origin: UserController.php:42

```

**N+1 detection:**

```
[N+1 Detected] GET /posts | Query repeated 15x: select * from comments where post_id = '3'

```

**Summary:**

```
[Query Summary] GET /posts | 18 queries | 320.50ms total

```

License
-------

[](#license)

MIT

###  Health Score

20

↑

LowBetter than 16% of packages

Maintenance64

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b66a7a56cce090d1bdc1e83e0f8e2e2ed1f05129e6f735ffcc69afb39cff60a3?d=identicon)[furkankufrevi](/maintainers/furkankufrevi)

---

Top Contributors

[![furkankufrevi](https://avatars.githubusercontent.com/u/46204100?v=4)](https://github.com/furkankufrevi "furkankufrevi (3 commits)")

### Embed Badge

![Health badge](/badges/furkankufrevi-laravel-slow-query-detector/health.svg)

```
[![Health](https://phpackages.com/badges/furkankufrevi-laravel-slow-query-detector/health.svg)](https://phpackages.com/packages/furkankufrevi-laravel-slow-query-detector)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.5k1.2B8.2k](/packages/psr-log)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k43.4M269](/packages/spatie-laravel-activitylog)[itsgoingd/clockwork

php dev tools in your browser

5.9k26.9M85](/packages/itsgoingd-clockwork)[arcanedev/log-viewer

Provides a Log Viewer for Laravel

2.4k6.7M49](/packages/arcanedev-log-viewer)[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90134.0M32](/packages/bugsnag-bugsnag-laravel)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41837.6M129](/packages/graylog2-gelf-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
