PHPackages                             the-toster/http-message-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. the-toster/http-message-logger

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

the-toster/http-message-logger
==============================

Log PSR MessageInterface instances to LoggerInterface

0.0.4(4y ago)02.0kMITPHPPHP ^7.4|^8.0

Since Dec 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/the-toster/http-message-logger)[ Packagist](https://packagist.org/packages/the-toster/http-message-logger)[ RSS](/packages/the-toster-http-message-logger/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/8e97c85b388182b9ce40cb404fa5bc7f14a332a649b48fcfc347b292ecacffa1/68747470733a2f2f7472617669732d63692e636f6d2f7468652d746f737465722f7073616c6d2d666d742e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/the-toster/http-message-logger)[![Psalm coverage](https://camo.githubusercontent.com/a30e5f15ba6c7b163e8665cf0c715e4e7dc1d72de80948d5c5bbe48e8f825b09/68747470733a2f2f73686570686572642e6465762f6769746875622f7468652d746f737465722f687474702d6d6573736167652d6c6f676765722f636f7665726167652e737667)](https://camo.githubusercontent.com/a30e5f15ba6c7b163e8665cf0c715e4e7dc1d72de80948d5c5bbe48e8f825b09/68747470733a2f2f73686570686572642e6465762f6769746875622f7468652d746f737465722f687474702d6d6573736167652d6c6f676765722f636f7665726167652e737667)

Logger for HTTP messages
========================

[](#logger-for-http-messages)

```
composer require the-toster/http-message-logger
```

Small logger to debug your API's.
You can use it like this:

```
use HttpMessageLogger\LoggerFactory;
/** @var \Psr\Log\LoggerInterface $psrLogger */
$logger = LoggerFactory::default($psrLogger, 'Prefix for log message');

/** @var \Psr\Http\Message\RequestInterface $request */
$logger->logRequest($request);

// ... doing stuff, calculating response

/** @var \Psr\Http\Message\ResponseInterface $response */
$logger->logResponse($response, $request);

```

It will dump full `$request` &amp; `$response` to your `$psrLogger`, tagged with corresponding request hash.

Also, you can instantiate it with your own formatter and, optionally, default log level:

```
use HttpMessageLogger\Logger;
use HttpMessageLogger\Formatter\DefaultFormatter;
// ...

/** @var \Psr\Log\LoggerInterface $psrLogger */
$logger = new Logger($psrLogger, new DefaultFormatter('Prefix for log message'), $logLevel);

```

You can also omit `request` when logging response, and you can pass log level:

```
$logger->logResponse($response);
$logger->logResponse($response, $request, 'info');

```

To customize logging format, just implements your own `HttpMessageLogger\Formatter\FormatterInterface` 🙂

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

4

Last Release

1666d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/62257854467f165e1ec97a01abf9999a603eca22a0345e9af7d33c1cf7413975?d=identicon)[the-toster](/maintainers/the-toster)

---

Top Contributors

[![the-toster](https://avatars.githubusercontent.com/u/22966096?v=4)](https://github.com/the-toster "the-toster (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/the-toster-http-message-logger/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[pagemachine/typo3-formlog

Form log for TYPO3

23238.6k8](/packages/pagemachine-typo3-formlog)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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