PHPackages                             chelout/laravel-http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. chelout/laravel-http-logger

ActiveLibrary[HTTP &amp; Networking](/categories/http)

chelout/laravel-http-logger
===========================

A Laravel package to log HTTP requests, headers and sessions

v1.4(6y ago)262.0k3MITPHPPHP ^7.1.3

Since Apr 4Pushed 6y ago2 watchersCompare

[ Source](https://github.com/chelout/laravel-http-logger)[ Packagist](https://packagist.org/packages/chelout/laravel-http-logger)[ Docs](https://github.com/chelout/laravel-http-logger)[ RSS](/packages/chelout-laravel-http-logger/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (3)Versions (9)Used By (0)

Log HTTP requests, headers and session data
===========================================

[](#log-http-requests-headers-and-session-data)

[![Latest Stable Version](https://camo.githubusercontent.com/ca5d6be4b6d511acf3dfc68c4ee9037164c343e3b3ca3c8aea3452d955a48071/68747470733a2f2f706f7365722e707567782e6f72672f6368656c6f75742f6c61726176656c2d687474702d6c6f676765722f762f737461626c65)](https://packagist.org/packages/chelout/laravel-http-logger)[![Total Downloads](https://camo.githubusercontent.com/07eb57efeb42521f3cbf8a964655cefb79b0807fa4abbb21f6f41b30d9e73db0/68747470733a2f2f706f7365722e707567782e6f72672f6368656c6f75742f6c61726176656c2d687474702d6c6f676765722f646f776e6c6f616473)](https://packagist.org/packages/chelout/laravel-http-logger)[![License](https://camo.githubusercontent.com/cbf119ebe32200dcb97fc96382b9d423eca9a36d0702c9ee42d1c596e49d1b4f/68747470733a2f2f706f7365722e707567782e6f72672f6368656c6f75742f6c61726176656c2d687474702d6c6f676765722f6c6963656e7365)](https://packagist.org/packages/chelout/laravel-http-logger)

This package provides a middleware to log incoming http requests data (body data, files, headers and session data). It utilizes [Laravel 5.6 logging servises](https://laravel.com/docs/5.6/logging) functionality. This package might be useful to log user requests to public apis.

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

[](#installation)

You can install the package via composer:

```
composer require chelout/laravel-http-logger
```

Optionally you can publish the configfile with:

```
php artisan vendor:publish --provider="Chelout\HttpLogger\HttpLoggerServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    /*
     * Log file path
     */
    'path' => storage_path('logs/http.log'),
    /*
     * The maximal amount of files to keep (0 means unlimited)
     */
    'max_files' => 5,

    /*
     * Log methods
     * [] - log all methods
     * ['get','post'] - log only 'get' and 'post' methods
     */
    'methods' => [],

    /*
     * Log message format.
     * For for details see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#customizing-the-log-format
     * and https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php
     */
    'format' => "[%datetime%] %extra.method% %extra.url% from %extra.ips% %context%\n",

    /*
     * Log message datetime format.
     * For for details see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#customizing-the-log-format
     * and https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php
     */
    'date_format' => null, // "Y-m-d\TH:i:sP"

    /*
     * Log current memory usage
     * @see https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/MemoryUsageProcessor.php
     */
    'memory_usage' => true,

    /*
     * Log peak memory usage
     * @see https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/MemoryPeakUsageProcessor.php
     */
    'memory_peak_usage' => true,

    /*
     * Log current git branch and commit
     * @see https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/GitProcessor.php
     */
    'git' => true,

    /*
     * false - don't log body fields
     * ['only'] - log fields only
     * ['except'] - don't log fields
     *
     * If ['only'] is set, ['except'] parametr will be omitted
     */
    // 'data' => false,
    'data' => [
        'only' => [],
        'except' => [],
    ],

    /*
     * false - don't log uploaded files
     * ['only'] - log files only
     * ['except'] - don't log files
     *
     * If ['only'] is set, ['except'] parametr will be omitted
     */
    // 'files' => false,
    'files' => [
        'only' => [],
        'except' => [],
    ],

    /*
     * false - don't log headers
     * ['only'] - log headers only
     * ['except'] - don't log headers
     *
     * If ['only'] is set, ['except'] parametr will be omitted
     */
    // 'headers' => false,
    'headers' => [
        'only' => ['user-agent'],
        'except' => [],
    ],

    /*
     * false - don't log session
     * ['only'] - log session only
     * ['except'] - don't log session
     *
     * If ['only'] is set, ['except'] parametr will be omitted
     */
    'session' => false,
    // 'session' => [
    //     'only' => [],
    //     'except' => [],
    // ],
];
```

Usage
-----

[](#usage)

This packages provides a middleware which can be added as a global middleware or as a single route.

```
// in `app/Http/Kernel.php`

protected $middleware = [
    // ...

    \Chelout\HttpLogger\Middlewares\HttpLogger::class
];
```

```
// in a routes file

Route::post('/submit-form', function () {
    //
})->middleware(\Chelout\HttpLogger\Middlewares\HttpLogger::class);
```

In order to log http requests you should add log custom log channel:

```
// in config/logging.php

return [
    // ...

    'channels' => [
        // ...

        'http-logger' => [
            'driver' => 'custom',
            'via' => \Chelout\HttpLogger\Loggers\HttpLogger::class,
        ],
    ],
];
```

You can also enhance existing log channel by customizing Monolog configuration:

```
// in config/logging.php

return [
    // ...

    'channels' => [
        // ...

        'single' => [
            'driver' => 'single',
            'tap' => [Chelout\HttpLogger\Loggers\MonologCustomizer::class],
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
        ],
    ],
];
```

### Todo

[](#todo)

- tests
- log git data?
- log memory usage?

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

Inspiration
-----------

[](#inspiration)

This package was inspired by [Log HTTP requests](https://github.com/spatie/laravel-http-logger) and [Laravel Log Enhancer](https://github.com/freshbitsweb/laravel-log-enhancer) and [Laravel 5.6 logging servises](https://laravel.com/docs/5.6/logging).

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Viacheslav Ostrovskiy](https://github.com/cheelout)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

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

Recently: every ~110 days

Total

7

Last Release

2552d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60cfb609b4fa19a2a1688987c6bdd70fe01d7b1cc3ab826593bb5997dc1b926d?d=identicon)[chelout](/maintainers/chelout)

---

Top Contributors

[![chelout](https://avatars.githubusercontent.com/u/9196257?v=4)](https://github.com/chelout "chelout (37 commits)")

---

Tags

headerslaravellogloggerloggingrequestsessionhttprequestlaravelheaderloggersession

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chelout-laravel-http-logger/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[mateusjunges/laravel-kafka

A kafka driver for laravel

7243.4M20](/packages/mateusjunges-laravel-kafka)[onlime/laravel-http-client-global-logger

A global logger for the Laravel HTTP Client

2037.5k](/packages/onlime-laravel-http-client-global-logger)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)

PHPackages © 2026

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