PHPackages                             vmpublishing/psr15-middleware-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. vmpublishing/psr15-middleware-request-logger

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

vmpublishing/psr15-middleware-request-logger
============================================

middleware to log every incoming request and response with varying levels of detail. also log all exceptions (and rethrow them)

1.0.2(6y ago)0466MITPHPPHP &gt;=7.2

Since Jun 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/vmpublishing/psr15-middleware-request-logger)[ Packagist](https://packagist.org/packages/vmpublishing/psr15-middleware-request-logger)[ RSS](/packages/vmpublishing-psr15-middleware-request-logger/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/031e5deae4ac6a86e62c9ea21394ed5bd4d5c7e9940bd363ab4fdd18464bf387/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d726571756573742d6c6f676765722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-request-logger/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/4cf9d06140542cf84e4761d07f8c83016e32302dcf8813eb8ae8791d42e0a0f6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d726571756573742d6c6f676765722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-request-logger/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/419023beed24566c229a9532d18a7dd5523ad13ecd175480c97474afe3d34c01/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d726571756573742d6c6f676765722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-request-logger/?branch=master)

**WHAT**

PSR-15 request logging middleware with as low dependencies as possible.

for maintenance reasons we like a slim, configurable logging middleware, that handles all the logging for us.

- every request
- every response
- every error
- every exception

This will rethrow any errors. error handling should be done on layers further out than this middleware.

**INSTALL**

To install simply use `composer require vmpublishing/psr15-middleware-request-logger:*@stable`

**USE**

This is a fancy wrapper for psr/log. So you will need to setup your own logger in any way you wish. After that, you can just simply create the middleware and use it

```
use VM\RequestLogger\Services\StandardLogFormatter;
use VM\RequestLogger\Middlewares\RequestLogger;

// given a logger in $logger, build the StandardLogFormatter (or write your own log formatter, using the interface)
$formatter = new StandardLogFormatter($logger);
$middleware = new RequestLogger($formatter);

// and for slim, given $app
$app->add($middleware);

// or just add it on the routes you want it on

```

The default setting is notice, and it won't log anything below that, whatever you set as log level in your logger. This is for optimization reasons. The formatter won't build any string or do any array magic, before the log level is sufficient.

If you want to log with a different level than the default, just pass that in:

```
use VM\RequestLogger\Services\LogLevel;
use VM\RequestLogger\Services\StandardLogFormatter;

$logLevel = new LogLevel(LogLevel::LEVEL_ERROR);
$formatter = new StandardLogFormatter($logger, $logLevel);
// ...

```

The StandardLogFormatter can be configured as for which log level to send at which message. just pass in an array to override the defaults. ie:

```
use VM\RequestLogger\Services\StandardLogFormatter;
use VM\RequestLogger\Services\LogLevel

$logLevel = new LogLevel(LogLevel::LEVEL_ERROR);
$logLevelRequestUri = new LogLevel(LogLevel::LEVEL_DEBUG);
$logLevelMappings = [StandardLogFormatter::MESSAGE_REQUEST_URI => $logLevelRequestUri];
$formatter = new StandardLogFormatter($logger, $logLevel, $logLevelMappings);

```

report any issues/feature requests on github. enjoy!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

Total

3

Last Release

2520d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c7c5b7f1c2b1888e5aa95e413f688597838e52abe6d77e93e541ea268a27519?d=identicon)[verticalmedia](/maintainers/verticalmedia)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vmpublishing-psr15-middleware-request-logger/health.svg)

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

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[scoutapp/scout-apm-php

Scout Application Performance Monitoring Agent - https://scoutapm.com

17877.0k5](/packages/scoutapp-scout-apm-php)[pagemachine/typo3-formlog

Form log for TYPO3

23225.3k6](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

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