PHPackages                             dniccum/laravel-request-logs - 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. dniccum/laravel-request-logs

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

dniccum/laravel-request-logs
============================

Log and debug HTTP requests within your Laravel application.

1.0.3(3y ago)1462[1 PRs](https://github.com/dniccum/laravel-request-logs/pulls)MITPHPPHP ^8.0|^8.1|^8.2CI passing

Since Oct 17Pushed 1mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (14)Versions (8)Used By (0)

Laravel Request Logs
====================

[](#laravel-request-logs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fabca45144860eba51b2d7d634ed9e2c8cf6f2703b586cf16ce7b31ce79d0452/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646e696363756d2f6c61726176656c2d726571756573742d6c6f67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dniccum/laravel-request-logs)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2899aa7127773de3292750738093618110af2de3ed77d3b7786a1827b6faf261/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646e696363756d2f6c61726176656c2d726571756573742d6c6f67732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/dniccum/laravel-request-logs/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/000332aba848950f8a7c9f7309bb350017b85221bd7a6921af20d43294f2e465/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646e696363756d2f6c61726176656c2d726571756573742d6c6f67732f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/dniccum/laravel-request-logs/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e6aceb07681af7a39af895433967e470dfd6a5f52e3fe1bf70f612072f87c9ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646e696363756d2f6c61726176656c2d726571756573742d6c6f67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dniccum/laravel-request-logs)

Provide insight to your application's requests with this Laravel-specific package. Simply add a light-weight middleware to your application and capture all the requests' body, headers, and responses. A console command is also provided that can be used to purge the logs to prevent any dated, unwanted bloat.

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

[](#installation)

You can install the package via composer:

```
composer require dniccum/laravel-request-logs
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-request-logs-migrations"
php artisan migrate --force
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-request-logs-config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Table Name
    |--------------------------------------------------------------------------
    |
    | The name of the table that will store the log entries.
    |
    */

    'table_name' => 'request_logs',

    /*
    |--------------------------------------------------------------------------
    | History
    |--------------------------------------------------------------------------
    |
    | The number of days of logs that you would like to keep in the database
    | at any time.
    |
    */

    'history' => env('LOGGING_HISTORY', 21),

    /*
    |--------------------------------------------------------------------------
    | Remove Bearer Token
    |--------------------------------------------------------------------------
    |
    | Enable if you would like to remove the bearer authentication token from
    | the request header.
    |
    */

    'remove_bearer' => env('LOGGING_REMOVE_BEARER', true),

];
```

Usage
-----

[](#usage)

### Middleware

[](#middleware)

#### Adding to Middleware Groups

[](#adding-to-middleware-groups)

If you would like to use this package's middleware across a large group of requests, like all of your `api` routes, you can apply it to your applications api middleware group within your `app/Http/Kernel.php` like so:

```
protected $middlewareGroups = [
        'web' => [
            ...
        ],

        'api' => [
            ...
            \Dniccum\LaravelRequestLogs\Http\Middleware\RequestLogging::class,
        ],
    ];
```

#### Adding to specific routes

[](#adding-to-specific-routes)

On the other hand, if you are wanting to add some logging clarity to specific routes, you can define it as a route middleware within your `app/Http/Kernel.php`:

```
/**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        ...
        'route-logging' => \Dniccum\LaravelRequestLogs\Http\Middleware\RequestLogging::class
    ];
```

and then assign it to a specific route within your routes file:

```
Route::post('/create-project', [ \App\Http\Controllers\SampleController::class, 'create' ])
    ->middleware([ 'route-logging' ]);
```

#### IMPORTANT: Response Body Length Limit

[](#important-response-body-length-limit)

Assuming that your database migration and model are unchanged, there is currently logic in place that will prevent the `response_body` column from being overloaded. What does this mean? In the event that the response body of the request that you are logging is very large (ie returning 500+ results from an API), the number of bytes/characters might be too large for the database to store without failing. If the response body **is longer than 65,000 characters, the response body will NOT be saved.**

### Log Cleanup (optional)

[](#log-cleanup-optional)

**Note** – this is not required but *HIGHLY* recommended as this could lead to large amounts of data within your database in short periods of time.

To automate the removal of older logs you can either use the provided artisan command `php artisan request-logs:clean` manually with your app's environment, or you can leverage your app's scheduler process within your `app/Console/Kernel.php` file to automate it like so:

```
$schedule->job(\Dniccum\LaravelRequestLogs\Commands\CleanReqeustLogsCommand::class)
    ->daily();
```

#### Stored History

[](#stored-history)

By default, this package will retain **21 days** of logs. This can be changed via environment variable (`LOGGING_HISTORY`) or simply modifying it within the `request-logs.php` configuration file.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Doug Niccum](https://github.com/dniccum)

License
-------

[](#license)

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

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance60

Regular maintenance activity

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

4

Last Release

1177d ago

PHP version history (3 changes)1.0.0PHP ^8.1

1.0.1PHP ^8.0|^8.1

1.0.3PHP ^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fe997126bcc6a6026a2f6c335ce125055af46178c82faa24d3087b7d5dc0b44?d=identicon)[dniccum](/maintainers/dniccum)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![dniccum](https://avatars.githubusercontent.com/u/2816415?v=4)](https://github.com/dniccum "dniccum (22 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (15 commits)")

---

Tags

laravellogsdniccumrequest-logslaravel-request-logs

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dniccum-laravel-request-logs/health.svg)

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

###  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

85810.0M83](/packages/spatie-laravel-health)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[spatie/laravel-error-share

Share your Laravel errors to Flare

43965.6k3](/packages/spatie-laravel-error-share)[tapp/filament-maillog

Filament plugin to view outgoing mail

2952.6k1](/packages/tapp-filament-maillog)

PHPackages © 2026

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