PHPackages                             consilience/laravel-slow-query-logger - 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. [Database &amp; ORM](/categories/database)
4. /
5. consilience/laravel-slow-query-logger

ActiveLibrary[Database &amp; ORM](/categories/database)

consilience/laravel-slow-query-logger
=====================================

Slow Query Logger for Laravel

2.0.1(3y ago)01.5k↑80%1[1 PRs](https://github.com/consilience/laravel-slow-query-logger/pulls)MITPHP

Since Jun 28Pushed 5mo agoCompare

[ Source](https://github.com/consilience/laravel-slow-query-logger)[ Packagist](https://packagist.org/packages/consilience/laravel-slow-query-logger)[ RSS](/packages/consilience-laravel-slow-query-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (7)Used By (0)

Slow Query Logger for Laravel
=============================

[](#slow-query-logger-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/1b52181c9b5d55bde0b677028f8ae7c98b301155bdd387c38e60b7d023eb3c77/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f6c61726176656c2d736c6f772d71756572792d6c6f676765722f762f737461626c652e737667)](https://packagist.org/packages/consilience/laravel-slow-query-logger) [![Latest Unstable Version](https://camo.githubusercontent.com/9dadb5acb9a9d9a379fe4603ddd905b80d0ba646d53da19526abc85b093753b8/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f6c61726176656c2d736c6f772d71756572792d6c6f676765722f762f756e737461626c652e737667)](https://packagist.org/packages/consilience/laravel-slow-query-logger) [![License](https://camo.githubusercontent.com/a6ea05475733301d302d611815fded576e28746ba4e89438c6a8876441c147e8/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f6c61726176656c2d736c6f772d71756572792d6c6f676765722f6c6963656e73652e737667)](https://packagist.org/packages/consilience/laravel-slow-query-logger) [![Total Downloads](https://camo.githubusercontent.com/a3d35bc01d7645d8fafa59d2f83b60213921246f0899f154393acd2338f4df4d/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f6c61726176656c2d736c6f772d71756572792d6c6f676765722f646f776e6c6f6164732e737667)](https://packagist.org/packages/consilience/laravel-slow-query-logger)

Installation/Quickstart
-----------------------

[](#installationquickstart)

```
composer require consilience/laravel-slow-query-logger

```

or add the following line to `composer.json` then run `composer update`:

```
"require": {
    "consilience/laravel-slow-query-logger": "^2.0"
}
```

Turn on slow query logging:

```
LARAVEL_SLOW_QUERY_LOGGER_ENABLED=true

```

Look into your log file to see your slow queries.

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

[](#configuration)

The configuration file can be published with the following command:

```
php artisan vendor:publish --provider="Consilience\Laravel\SlowQueryLogger\SlowQueryLoggerProvider"

```

You will likely not need to publish the config; just set required environment variables as listed below.

### `enabled`

[](#enabled)

Enable the slow queries logger.

You can set this value through environment variable `LARAVEL_SLOW_QUERY_LOGGER_ENABLED`. It is `false` by default.

### `channel`

[](#channel)

Sets the channel to log in. This can be handy if you want to keep all query logs separate from other log messages.

You can set this value through environment variable `LARAVEL_SLOW_QUERY_LOGGER_CHANNEL`. By default, the application default logging channel will be used.

### `level`

[](#level)

Set the log-level for logging the slow queries.

You can set this value through environment variable `LARAVEL_SLOW_QUERY_LOGGER_LEVEL`. It is `debug` by default.

### `threshold-ms`

[](#threshold-ms)

Only log queries that take longer than this number of milliseconds to complete.

You can set this value through environment variable `LARAVEL_SLOW_QUERY_LOGGER_THRESHOLD_MS`. It is `700` by default. A value of 0 will log all queries.

Usage
-----

[](#usage)

By default, bind variables are not included in the logged details. Just the core query is logged:

> \[20\[2022-08-02 22:15:33\] production.DEBUG: SQL 6663.970 mS: update `users` set `name` = ?, `users`.`updated_at` = ? where `id` = ?

By setting `LARAVEL_SLOW_QUERY_LOGGER_REPLACE_BINDINGS=true` the query will have its bind variables substituted with the matching values:

> \[2022-08-02 16:17:13\] production.DEBUG: SQL 784.200 mS: update `users` set `name` = 'JJ', `users`.`updated_at` = '2022-08-02 16:17:05' where `id` = '1'

You can also (or alternatively) list the bind data separately in the context of the log by setting `LARAVEL_SLOW_QUERY_LOGGER_SHOW_BINDINGS=true`. This may be useful to observe the data types in more detail, since substituting the bindings will treat all values as strings.

> \[2022-08-02 22:22:35\] production.DEBUG: SQL 413.910 mS: update `users` set `name` = 'JJ', `users`.`updated_at` = '2022-08-02 22:21:50' where `id` = '1' {"bindings":\["JJ","2022-08-02 22:21:50",1\]}

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance48

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~556 days

Total

5

Last Release

1379d ago

Major Versions

0.0.1 → 1.0.02018-07-25

1.0.1 → 2.0.02022-06-17

PHP version history (2 changes)0.0.1PHP &gt;=5.5.9

1.0.0PHP ^7.1.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/395934?v=4)[Jason Judge](/maintainers/judgej)[@judgej](https://github.com/judgej)

---

Top Contributors

[![judgej](https://avatars.githubusercontent.com/u/395934?v=4)](https://github.com/judgej "judgej (7 commits)")

### Embed Badge

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

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

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

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