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

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

xxxcoltxxx/request-logger
=========================

Logging http requests and errors

1.0.5(7y ago)10447[1 PRs](https://github.com/xxxcoltxxx/request-logger/pulls)PHPPHP ^7.1

Since Sep 8Pushed 7y ago2 watchersCompare

[ Source](https://github.com/xxxcoltxxx/request-logger)[ Packagist](https://packagist.org/packages/xxxcoltxxx/request-logger)[ RSS](/packages/xxxcoltxxx-request-logger/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (9)Used By (0)

📝 Laravel request logger
========================

[](#memo-laravel-request-logger)

[![Build Status](https://camo.githubusercontent.com/170523e3da5e77723f2ae41810f4f7595d7281de4123c12f5ba800154604c910/68747470733a2f2f7472617669732d63692e636f6d2f787878636f6c747878782f726571756573742d6c6f676765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/xxxcoltxxx/request-logger)[![Latest Stable Version](https://camo.githubusercontent.com/45f985301b6f4dbe118f9432e6bf56d11b2c2b0d742458c979f6c23c28252b51/68747470733a2f2f706f7365722e707567782e6f72672f787878636f6c747878782f726571756573742d6c6f676765722f762f737461626c65)](https://packagist.org/packages/xxxcoltxxx/request-logger)[![Total Downloads](https://camo.githubusercontent.com/aacd4456e0fc04f35220efb0460851dff5aecab29e80a7d482d00cf0ffeb8536/68747470733a2f2f706f7365722e707567782e6f72672f787878636f6c747878782f726571756573742d6c6f676765722f646f776e6c6f616473)](https://packagist.org/packages/xxxcoltxxx/request-logger)

This package allows sending request and response payload to the external logging system.

Supported out-of-box transports:

- `graylog` transport for sending request log to [Graylog server](https://www.graylog.org)
- `log` transport for sending request log to [Laravel logging system](https://laravel.com/docs/5.7/logging)
- `null` transport for skip request log in application tests

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

[](#installation)

Install via composer

```
composer require xxxcoltxxx/request-logger
```

Publish the configuration file

```
php artisan vendor:publish --provider="RequestLogger\RequestLoggerServiceProvider"
```

Add exception reporting to your `app/Exception/Handler.php` file

```
public function report(Exception $exception)
{
    request_logger()->setException($exception);

    // ...
    parent::report($exception);
}
```

Fill configuration

```
// Enable request logger for all requests without adds middleware
'all_routes' => true,

// Default transport
'default' => env('REQUEST_LOGGER_TRANSPORT', 'graylog'),

// The class for format log message
'formatter' => RequestLogger\RequestFormatter::class,

/*
 * Allowed transports with its configuration.
 * Drivers: 'graylog', 'log', 'null'
 */
'transports' => [

    // The graylog transport
    'graylog' => [
        // The Short message for graylog
        'short_message' => env('GRAYLOG_SHORT_MESSAGE', 'requests'),

        // Limit content size (in bytes). Set false to disable. Graylog has limitations on input messages
        'content_limit' => env('GRAYLOG_CONTENT_LIMIT', 30000),

        // The IP address of the log server
        'host' => env('GRAYLOG_HOST', '127.0.0.1'),

        // The UDP port of the log server
        'port' => env('GRAYLOG_PORT', '12201'),

        // The driver for send requests log to log server
        'driver' => RequestLogger\Transports\GelfUdpTransport::class,
    ],

    // ...
],
```

Adding app messages to request log
----------------------------------

[](#adding-app-messages-to-request-log)

You can add custom messages to payload with `request_logger` helper.

```
request_logger()->addMessage('Full name: John Doe')
```

Enable logging only for specific routes
---------------------------------------

[](#enable-logging-only-for-specific-routes)

Request logger enabled on all routes by default. You can disable `all_routes` option in the configuration file and use `request_logger` middleware in routes configuration.

Documentation for registering middleware can be found in [Laravel documentation](https://laravel.com/docs/5.7/middleware#registering-middleware)

```
# config/request_logger.php

return [
    'all_routes' => false,

    // ...
];

# routes/api.php

Route::get('admin/profile', function () {
    //
})->middleware('request_logger');
```

Custom log format
-----------------

[](#custom-log-format)

For custom log format you can use closure in the configuration file:

```
# config/request_logger.php

return [
    // ...

    'formatter' => function () {
        $provider  = request_logger();
        $exception = $provider->getException();
        $request   = $provider->getRequest();
        $response  = $provider->getResponse();

        return [
            'uri'           => $request->getRequestUri(),
            'has_exception' => ! is_null($exception),
        ];
    }

    // ...
```

Writing custom drivers
----------------------

[](#writing-custom-drivers)

For writing custom driver you must add driver configuration and implement `RequestLogger\Transports\RequestLoggerTransport` interface:

```
# .env

REQUEST_LOGGER_TRANSPORT=custom

# config/request_logger.php

return [
    // ...

    'transports' => [
        // ...

        'custom' => [
            'driver' => Namespace\CustomTransport::class,
            'custom_option' => 'value',
        ],
    ],
];
```

Disable request logger in application tests
-------------------------------------------

[](#disable-request-logger-in-application-tests)

Use `null` driver. You can use `REQUEST_LOGGER_TRANSPORT` variable in `phpunit.xml` configuration file.

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit tests
```

Roadmap
-------

[](#roadmap)

1. Unit tests
2. Write Documentation for:
    - Custom log format
    - Writing custom drivers
3. Add `log` driver
4. Add `null` driver
5. Add changelog
6. Make video "How it works with graylog"

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

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

Recently: every ~31 days

Total

6

Last Release

2728d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5069097?v=4)[Aleksandr Paramonov](/maintainers/xxxcoltxxx)[@xxxcoltxxx](https://github.com/xxxcoltxxx)

---

Top Contributors

[![xxxcoltxxx](https://avatars.githubusercontent.com/u/5069097?v=4)](https://github.com/xxxcoltxxx "xxxcoltxxx (25 commits)")

---

Tags

gelfgrayloglaravelloggerphprequestsphplaravelloggergrayloggelfrequests

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[hedii/laravel-gelf-logger

A Laravel package to send logs to a gelf compatible backend like graylog

1353.6M11](/packages/hedii-laravel-gelf-logger)[ucan-lab/laravel-blink-logger

Comprehensive Logging Tool for Laravel.

137.2k](/packages/ucan-lab-laravel-blink-logger)[tomatophp/filament-logger

Log all user activity to file or log driver and preview it on your FilamentPHP panel

152.3k](/packages/tomatophp-filament-logger)

PHPackages © 2026

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