PHPackages                             overtrue/laravel-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. overtrue/laravel-query-logger

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

overtrue/laravel-query-logger
=============================

A dev tool to log all queries for laravel application.

v5.1.0(3mo ago)411324.4k↓17.8%46[12 PRs](https://github.com/overtrue/laravel-query-logger/pulls)6MITPHPCI passing

Since Sep 7Pushed 2w ago7 watchersCompare

[ Source](https://github.com/overtrue/laravel-query-logger)[ Packagist](https://packagist.org/packages/overtrue/laravel-query-logger)[ GitHub Sponsors](https://github.com/overtrue)[ RSS](/packages/overtrue-laravel-query-logger/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (8)Versions (45)Used By (6)

 Laravel Query Logger
======================

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

 📝 A dev tool to log all queries for Laravel application.

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)

Installing
----------

[](#installing)

```
$ composer require overtrue/laravel-query-logger -vvv
```

Laravel Query Logger will be enabled when `LOG_QUERY` is `true`.

Usage
-----

[](#usage)

```
$ tail -f ./storage/logs/laravel.log
```

```
[2017-09-05 14:52:14] local.DEBUG: [800μs] select count(*) as aggregate from `discussions` where `discussions`.`deleted_at` is null | GET: http://laravel.app/discussions
[2017-09-05 14:52:14] local.DEBUG: [1.07ms] select * from `discussions` where `discussions`.`deleted_at` is null order by `is_top` desc, `created_at` desc limit 15 offset 0 | GET: http://laravel.app/discussions
[2017-09-05 14:52:14] local.DEBUG: [3.63s] select `tags`.*, `taggables`.`taggable_id` as `pivot_taggable_id`, `taggables`.`tag_id` as `pivot_tag_id` from `tags` inner join `taggables` on `tags`.`id` = `taggables`.`tag_id` where `taggables`.`taggable_id` in ('1', '2', '3', '4', '5', '6', '7', '8') and `taggables`.`taggable_type` = 'App\\Models\\Discussion' order by `order_column` asc | GET: http://laravel.app/discussions
[2017-09-05 14:52:14] local.DEBUG: [670μs] select * from `users` where `users`.`id` in ('1', '2', '4') and `users`.`deleted_at` is null | GET: http://laravel.app/discussions
...

```

### Configuration

[](#configuration)

You can also control whether to log a query via the configuration file：

*config/logging.php:*

```
return [
    //...
    'query' => [
        'enabled' => env('LOG_QUERY', env('APP_ENV') === 'local'),

        // Only record queries that are slower than the following time
        // Unit: milliseconds
        'slower_than' => 0,

        // Only record queries when the QUERY_LOG_TRIGGER is set in the environment,
        // or when the trigger HEADER, GET, POST, or COOKIE variable is set.
        'trigger' => env('QUERY_LOG_TRIGGER'),

        // Except record queries
        'except' => [
            // '*_telescope_*',
        ],

        // Log Channel
        'channel' => 'stack',
    ],
];
```

❤️ Sponsor me
-------------

[](#heart-sponsor-me)

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)

如果你喜欢我的项目并想支持它，[点击这里 ❤️](https://github.com/sponsors/overtrue)

Project supported by JetBrains
------------------------------

[](#project-supported-by-jetbrains)

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.

[![](https://camo.githubusercontent.com/3cf726e7cdadba47755b7f7ea4227945a92a2fa48aadf4a2573140ec6501c989/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a625f6265616d2e737667)](https://www.jetbrains.com/?from=https://github.com/overtrue)

PHP 扩展包开发
---------

[](#php-扩展包开发)

> 想知道如何从零开始构建 PHP 扩展包？
>
> 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)

License
-------

[](#license)

MIT

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity55

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~124 days

Recently: every ~135 days

Total

26

Last Release

105d ago

Major Versions

1.2.0 → 2.0.02020-09-21

2.1.4 → 3.0.02022-02-10

3.4.0 → v4.0.02026-03-21

v4.0.0 → v5.0.02026-03-21

### Community

Maintainers

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

---

Top Contributors

[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (66 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (3 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![iwindy](https://avatars.githubusercontent.com/u/23478189?v=4)](https://github.com/iwindy "iwindy (2 commits)")[![bolechen](https://avatars.githubusercontent.com/u/195015?v=4)](https://github.com/bolechen "bolechen (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![guanguans](https://avatars.githubusercontent.com/u/22309277?v=4)](https://github.com/guanguans "guanguans (2 commits)")[![seekerliu](https://avatars.githubusercontent.com/u/8923281?v=4)](https://github.com/seekerliu "seekerliu (2 commits)")[![YL20181120](https://avatars.githubusercontent.com/u/5860349?v=4)](https://github.com/YL20181120 "YL20181120 (2 commits)")[![ruchengtang](https://avatars.githubusercontent.com/u/1282479?v=4)](https://github.com/ruchengtang "ruchengtang (2 commits)")[![osindex](https://avatars.githubusercontent.com/u/4703215?v=4)](https://github.com/osindex "osindex (1 commits)")[![summerblue](https://avatars.githubusercontent.com/u/324764?v=4)](https://github.com/summerblue "summerblue (1 commits)")

---

Tags

laravelloggerqueryquery-logger

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[open-telemetry/opentelemetry-auto-laravel

OpenTelemetry auto-instrumentation for Laravel

592.7M9](/packages/open-telemetry-opentelemetry-auto-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[nightowl/agent

NightOwl monitoring agent — collects telemetry from laravel/nightwatch and writes to PostgreSQL

771.7k](/packages/nightowl-agent)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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