PHPackages                             interfasys/lognormalizer - 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. interfasys/lognormalizer

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

interfasys/lognormalizer
========================

Parses variables and converts them to string so that they can be logged

v1.0(10y ago)21.1M↓47.8%2AGPL-3.0PHPPHP &gt;=5.4.0

Since Aug 1Pushed 5y ago2 watchersCompare

[ Source](https://github.com/interfasys/lognormalizer)[ Packagist](https://packagist.org/packages/interfasys/lognormalizer)[ Docs](https://github.com/interfasys/lognormalizer)[ RSS](/packages/interfasys-lognormalizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Log Normalizer
--------------

[](#log-normalizer)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/92cd02a0a7f68900a21c20fad58116db60e9cda87cf4c6036a6eb470136e6bd3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e74657266617379732f6c6f676e6f726d616c697a65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/interfasys/lognormalizer/?branch=master)[![Code Climate](https://camo.githubusercontent.com/89399d5dc2eac6167d3ce9e7f221fffcebad523cf7248dc4975c1a62056435c5/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f696e74657266617379732f6c6f676e6f726d616c697a65722f6261646765732f6770612e737667)](https://codeclimate.com/github/interfasys/lognormalizer)[![Build Status](https://camo.githubusercontent.com/ca5f10bc9be9d0155f5f168b6e95c528cd3ad97e8ccdff20704137fa0d4fd1c0/68747470733a2f2f7472617669732d63692e6f72672f696e74657266617379732f6c6f676e6f726d616c697a65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/interfasys/lognormalizer)[![Code Coverage](https://camo.githubusercontent.com/8d753a4bd69819f84f3ef6bc59b8a1e01cf518bf5629e66b297f6993d2200bd1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f696e74657266617379732f6c6f676e6f726d616c697a65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/interfasys/lognormalizer/?branch=master)

Parses variables and converts them to string so that they can be logged

Based on the [Monolog](https://github.com/Seldaek/monolog) formatter/normalizer.

How to use
----------

[](#how-to-use)

### Initialisation in your class

[](#initialisation-in-your-class)

```
use InterfaSys\LogNormalizer\Normalizer;

$normalizer = new Normalizer();
```

The constructor supports the following optional arguments

- `int $maxRecursionDepth`: The maximum depth at which you want to go in objects and arrays
- `int $maxArrayItems`: The maximum number of elements you want to show, when parsing an array or an object
- `string $dateFormat`: The format to apply to dates

### Format variables before logging them

[](#format-variables-before-logging-them)

This is what your logging function could look like

```
/**
 * Converts the variables in the received log message to string before
 * sending everything to the real logger
 *
 * @param string $level
 * @param string $message
 * @param array $variables
 *
 * @return mixed
 */
public function log($level, $message, array $variables= []) {
	array_walk($variables, [$this->normalizer, 'format']);

	// Then use your current PSR-3 compatible logging system
	$this->logger->log($level, $message, $variables);
}
```

And you would call it like this from another class

```
$myLogger->log('debug',
	'Logger test {var1}, {var2}',
	[
		'var1' => $var1,
		'var2' => $var2
		]
);
```

### Convert a single variable to a string

[](#convert-a-single-variable-to-a-string)

```
$normalizedVariable = $this->normalizer->format($variable);
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3943d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/262a31a94ab337b836ffa34c990bccbed10510aa5996f0aa02c3c7240410e04c?d=identicon)[interfaSys](/maintainers/interfaSys)

---

Top Contributors

[![oparoz](https://avatars.githubusercontent.com/u/323220?v=4)](https://github.com/oparoz "oparoz (33 commits)")

---

Tags

lognormalizer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/interfasys-lognormalizer/health.svg)

```
[![Health](https://phpackages.com/badges/interfasys-lognormalizer/health.svg)](https://phpackages.com/packages/interfasys-lognormalizer)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry

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

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

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)

PHPackages © 2026

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