PHPackages                             mpernia/request-query-monitor - 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. mpernia/request-query-monitor

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

mpernia/request-query-monitor
=============================

Laravel monitoring package for queries and API requests

1.0.2(1y ago)07MITPHPPHP ^8.1

Since Mar 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mpernia/request-query-monitor)[ Packagist](https://packagist.org/packages/mpernia/request-query-monitor)[ Docs](https://github.com/mpernia/request-query-monitor)[ RSS](/packages/mpernia-request-query-monitor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Request Query Monitor
=====================

[](#request-query-monitor)

Request Query Monitor for Laravel

**RequestQueryMonitor for Laravel** is a lightweight package designed to monitor and log **API requests** and **database queries** in your Laravel applications. It helps you identify slow endpoints and database queries, providing better visibility into your application's performance.

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

[](#installation)

Install via Composer:

```
composer require mpernia/request-query-monitor
```

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

[](#configuration)

Publish the configuration files:

```
php artisan vendor:publish --tag=monitoring-config
```

This will publish the following files into your `config` folder: `monitoring.php`

**Note:** add this flag `--force` to overwrite any existing files.

Environment variables
---------------------

[](#environment-variables)

You can also set these values in your `.env` file:

```
QUERY_LOGGER_ENABLED=false                 # Enabled the queries logged
QUERY_LOGGER_ENABLED_MEMORY_USAGE=false    # Enabled return the memory usage
QUERY_LOGGER_SLOW_THRESHOLD=100            # Slow query threshold in milliseconds
QUERY_LOGGER_FILENAME=query                # The name of the log file
REQUEST_LOGGER_ENABLED=false               # Enabled the requests logged
REQUEST_LOGGER_ENABLED_MEMORY_USAGE=false  # Enabled return the memory usage
REQUEST_LOGGER_SLOW_THRESHOLD=500          # Slow request threshold in milliseconds
REQUEST_LOGGER_FILENAME=request            # The name of the log file
```

Usage
-----

[](#usage)

### Database Query Logging

[](#database-query-logging)

When `QUERY_LOGGER_ENABLED` is set to `true`, all executed database queries are logged, with warnings for queries exceeding the configured threshold.

### API Request Logging

[](#api-request-logging)

#### Registering the middleware `ApiRequestLogger` in

[](#registering-the-middleware-apirequestlogger-in)

##### Laravel version 11 or higher:

[](#laravel-version-11-or-higher)

Edit the `bootstrap/app.php` file and put this code:

```
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->group('web', [
            \RequestQueryMonitor\Http\Middleware\ApiRequestLogger::class,
        ]);
        $middleware->group('api', [
            \RequestQueryMonitor\Http\Middleware\ApiRequestLogger::class,
        ]);
    })
```

##### laravel version 10 or lower:

[](#laravel-version-10-or-lower)

Edit the `app/Http/Kernel.php` file and put this code:

```
    protected $middlewareGroups = [
        'web' => [
            \RequestQueryMonitor\Http\Middleware\ApiRequestLogger::class,
        ],
        'api' => [
            \RequestQueryMonitor\Http\Middleware\ApiRequestLogger::class,
        ],
    ];
```

All incoming API requests will be logged, including:

- HTTP method
- Full URL
- Response status code
- Execution time (in milliseconds)
- IP address
- User agent
- Incoming payload (with sensitive data like passwords automatically excluded)

Examples
--------

[](#examples)

### Request Log Output

[](#request-log-output)

The HTTP request information is logged:

```
{
    "method": "POST",
    "url": "https://example.com/api/v1/orders",
    "status": 201,
    "duration_ms": 245.87,
    "ip": "123.45.67.89",
    "user_agent": "PostmanRuntime/7.36.0",
    "payload": {
        "product_id": 123,
        "quantity": 2
    }
}
```

### Query Log Output

[](#query-log-output)

Database queries will log like this:

```
{
    "query": "select * from users where email = 'john@example.com'",
    "time_ms": 5.24
}
```

### View Log with Artisan Command

[](#view-log-with-artisan-command)

#### Show Requests Log on console

[](#show-requests-log-on-console)

```
php artisan show:log --requests --file=request-monitor. log
```

#### Output

[](#output)

LevelMethodURLResponse SizeDuration (ms)RAMReal RAMWARNINGGET206.06 KB937.743.03 MB12.00 MBINFOPOST1.37 KB281.132.75 MB12.00 MB#### Show Queries Log on console

[](#show-queries-log-on-console)

```
php artisan show:log --queries --file=query-monitor.log
```

#### Output

[](#output-1)

LevelClassMethodDuration (ms)RAMReal RAMWARNINGApp\\Repositories\\Order\\OrderRepositorysearch170.832.62 MB12.00 MBINFOApp\\Repositories\\Order\\OrderRepositorycreate1.582.63 MB12.00 MBLicense
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance45

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~7 days

Total

2

Last Release

425d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelmonitoringpackage

### Embed Badge

![Health badge](/badges/mpernia-request-query-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/mpernia-request-query-monitor/health.svg)](https://phpackages.com/packages/mpernia-request-query-monitor)
```

###  Alternatives

[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[inspector-apm/inspector-laravel

Code Execution Monitoring, built for developers.

2332.0M2](/packages/inspector-apm-inspector-laravel)[jackwh/laravel-new-relic

Monitor your Laravel application performance with New Relic

112827.2k](/packages/jackwh-laravel-new-relic)[kssadi/log-tracker

A powerful, intuitive, and efficient log viewer for Laravel applications.

264.8k](/packages/kssadi-log-tracker)

PHPackages © 2026

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