PHPackages                             bilfeldt/laravel-request-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. bilfeldt/laravel-request-logger

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

bilfeldt/laravel-request-logger
===============================

Log Laravel application request and responses for debugging or statistics

v3.8.0(2mo ago)122163.3k↑49%11[1 PRs](https://github.com/bilfeldt/laravel-request-logger/pulls)1MITPHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Nov 7Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/bilfeldt/laravel-request-logger)[ Packagist](https://packagist.org/packages/bilfeldt/laravel-request-logger)[ Docs](https://github.com/bilfeldt/laravel-request-logger)[ GitHub Sponsors](https://github.com/bilfeldt)[ RSS](/packages/bilfeldt-laravel-request-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (21)Used By (1)

Flexible and extendable logging of Laravel application request and responses
============================================================================

[](#flexible-and-extendable-logging-of-laravel-application-request-and-responses)

[![bilfeldt/laravel-request-logger](art/banner.png)](art/banner.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27cc1fc1b580d49968d56ed0e48e4248697653bacfaeb7a3c01cb6e6df237e33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62696c66656c64742f6c61726176656c2d726571756573742d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bilfeldt/laravel-request-logger)[![GitHub Tests Action Status](https://github.com/bilfeldt/laravel-request-logger/actions/workflows/run-tests.yml/badge.svg)](https://github.com/bilfeldt/laravel-request-logger/actions/workflows/run-tests.yml)[![StyleCI Code Style Status](https://camo.githubusercontent.com/7a788c259cf501aa9d4b8cfc987204690307dd272148812386063cba7248cdc8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3432343932383337302f736869656c64)](https://github.styleci.io/repos/424928370/shield)[![Total Downloads](https://camo.githubusercontent.com/a52dfe2e7d2336bb36605b2004ce2b6e1b1299a783fa20add6fa330512152d82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62696c66656c64742f6c61726176656c2d726571756573742d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bilfeldt/laravel-request-logger)

Zero configuration logging of Requests and Responses to database or custom drivers in Laravel applications - no more issues debugging customer support requests.

VersionLaravelPHP1.\*8.\* | 9.\*7.4.\* | 8.0.\* | 8.1.\*2.\*10.\*8.1.\* | 8.2.\*3.\*10.\* | 11.\* | 12.\*8.1.\* | 8.2.\* | 8.3.\* | 8.4.\*Installation
------------

[](#installation)

You can install the package via composer:

```
composer require bilfeldt/laravel-request-logger
```

Publish and run the migrations with:

```
php artisan vendor:publish --provider="Bilfeldt\RequestLogger\RequestLoggerServiceProvider" --tag="request-logger-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Bilfeldt\RequestLogger\RequestLoggerServiceProvider" --tag="request-logger-config"
```

Usage
-----

[](#usage)

It is possible to enable logging of all or some requests conditionally using one of the approaches below.

### Enable log via middleware (Recommended)

[](#enable-log-via-middleware-recommended)

This package comes with a convenient `requestlog` middleware that can be used to enable logging of request by simply registering the middleware on the routes (or route groups) you wish to log:

```
Route::middleware('requestlog')->get('/', function () {
    return 'Hello World';
});
```

### Enable via config file

[](#enable-via-config-file)

The config file includes some convenient settings for enabling logging of all or some requests:

```
// Enable all requests:
'log_methods' => ['*'],

// or enable all server errors
'log_statuses' => ['5**'],
```

### Enable log via request

[](#enable-log-via-request)

This package adds a macro on the `Illuminate\Http\Request` class making it possible to enable logging directly from the request:

```
/**
 * Index posts.
 *
 * @param  Request  $request
 * @return Response
 */
public function index(Request $request)
{
    $request->enableLog();

    //
}
```

Extending with custom Drivers
-----------------------------

[](#extending-with-custom-drivers)

This package implements the [Laravel Manager Class](https://inspector.dev/how-to-extend-laravel-with-driver-based-services/) making it possible to easily register custom drivers either in your application or by third party packages.

An `example` driver can be specified as middleware parameters:

```
Route::middleware('log:example')->get('/', function () {
    return 'Hello World';
});
```

or via request macro:

```
$request->enableLog('example');
```

Pruning
-------

[](#pruning)

The number of logged requests can quickly grow if you are not pruning the logs regularly. In order to keep the logs manageable, you can use the `prune` command to remove old logs as [described in the Laravel Docs](https://laravel.com/docs/8.x/eloquent#pruning-models):

```
$schedule->command('requestlog:prune')->daily();
```

Note that the default `RequestLog` model setup by this package will not be discovered as a "Prunable" model by Laravel default `model:prune` command as it does not reside in the `app/Models` directory. If you change this class in the configuration to a custom class this will be auto registered and the command above will be needless.

Notes and advises
-----------------

[](#notes-and-advises)

### Proxies and load balancers

[](#proxies-and-load-balancers)

When using proxies and/or load balancers then the IP address of the proxy/load balancer must be listed as a [Trusted Proxy](https://laravel.com/docs/8.x/requests#configuring-trusted-proxies) for the users IP address to be correctly logged as the IP of the proxy itself will be logged otherwise.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Anders Bilfeldt](https://github.com/bilfeldt)
- [Laravel Telescope](https://github.com/laravel/telescope/blob/master/src/Watchers/RequestWatcher.php): Collection of data from request/response is almost entirely taken from this package.
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 84% 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 ~87 days

Recently: every ~114 days

Total

19

Last Release

74d ago

Major Versions

v0.3.0 → v1.0.02021-11-12

v1.1.0 → v2.0.02023-05-01

v2.2.0 → v3.0.02023-09-29

PHP version history (7 changes)v0.1.0PHP ^7.4|^8.0

v1.1.0PHP ^7.4 || ^8.0

v2.0.0PHP ~8.2.0

v2.1.0PHP ~8.1.0 || ~8.2.0

v3.1.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

v3.4.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

v3.7.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

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

---

Top Contributors

[![bilfeldt](https://avatars.githubusercontent.com/u/30228807?v=4)](https://github.com/bilfeldt "bilfeldt (121 commits)")[![onlime](https://avatars.githubusercontent.com/u/2759561?v=4)](https://github.com/onlime "onlime (7 commits)")[![MuriloChianfa](https://avatars.githubusercontent.com/u/60560085?v=4)](https://github.com/MuriloChianfa "MuriloChianfa (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![DevHoracioRodriguez](https://avatars.githubusercontent.com/u/7793925?v=4)](https://github.com/DevHoracioRodriguez "DevHoracioRodriguez (4 commits)")[![comes](https://avatars.githubusercontent.com/u/592262?v=4)](https://github.com/comes "comes (2 commits)")[![woenel](https://avatars.githubusercontent.com/u/8844488?v=4)](https://github.com/woenel "woenel (2 commits)")

---

Tags

laravelbilfeldtlaravel-request-logger

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bilfeldt-laravel-request-logger/health.svg)

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

###  Alternatives

[opcodesio/log-viewer

Fast and easy-to-use log viewer for your Laravel application

4.3k8.9M50](/packages/opcodesio-log-viewer)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[bilfeldt/laravel-route-statistics

Log statistics about route usage per user/team

240132.9k2](/packages/bilfeldt-laravel-route-statistics)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[inspector-apm/inspector-laravel

Code Execution Monitoring, built for developers.

2332.0M2](/packages/inspector-apm-inspector-laravel)

PHPackages © 2026

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