PHPackages                             neeckeloo/monolog-module - 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. neeckeloo/monolog-module

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

neeckeloo/monolog-module
========================

Monolog integration into Laminas

v1.3.0(3y ago)8188.8k↓33.6%3[2 PRs](https://github.com/neeckeloo/monolog-module/pulls)MITPHPPHP ^8.0

Since Nov 14Pushed 3y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (14)Used By (0)

Monolog module for Laminas
==========================

[](#monolog-module-for-laminas)

Module to integrate Monolog with Laminas projects.

[![Build Status](https://camo.githubusercontent.com/e8581f065bdf7f1d5c679e3f162907fbfb1e1cb3a264e5070fa336e154416d78/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e6565636b656c6f6f2f6d6f6e6f6c6f672d6d6f64756c652e7376673f7374796c653d666c61742d737175617265)](http://travis-ci.org/neeckeloo/monolog-module)[![Latest Stable Version](https://camo.githubusercontent.com/163acd32d95d438d18d6b376297bb11ffb440d46dd1f07aa928723eb5716821e/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6565636b656c6f6f2f6d6f6e6f6c6f672d6d6f64756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/neeckeloo/monolog-module)[![Total Downloads](https://camo.githubusercontent.com/8474e71e7cd77453398ae039b50e85eaed1be2a1a6da6b13f07ddac3b4145393/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6565636b656c6f6f2f6d6f6e6f6c6f672d6d6f64756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/neeckeloo/monolog-module)[![Coverage Status](https://camo.githubusercontent.com/0e321f91853d3e34f5dda88490b87a0cd895178b7b5a6886478f4088f5ccf149/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6e6565636b656c6f6f2f4d6f6e6f6c6f674d6f64756c652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/neeckeloo/MonologModule)

Requirements
------------

[](#requirements)

- PHP ^8.0
- [monolog/monolog ^2.0 || ^3.0](http://www.github.com/Seldaek/monolog)
- [laminas/laminas-servicemanager ^3.3.2](https://github.com/laminas/laminas-servicemanager)

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

[](#installation)

MonologModule must be installed through Composer. For Composer documentation, please refer to [getcomposer.org](http://getcomposer.org).

You can install the module from command line:

```
$ composer require neeckeloo/monolog-module
```

Enable the module by adding `MonologModule` key in your `application.config.php` file.

Usage
-----

[](#usage)

### Configuring a logger

[](#configuring-a-logger)

This is the configuration of a logger that can be retrieved with key `Log\App` in the service manager. A channel name `default` is also defined to identify to which part of the application a record is related.

```
return [
    'monolog' => [
        'loggers' => [
            'Log\App' => [
                'name' => 'default',
            ],
        ],
    ],
];
```

### Adding a handler

[](#adding-a-handler)

The logger itself does not know how to handle a record. It delegates it to some handlers. The code above registers two handlers in the stack to allow handling records in two different ways.

```
return [
    'monolog' => [
        'loggers' => [
            'Log\App' => [
                'name' => 'default',
                'handlers' => [
                    'stream' => [
                        'name' => StreamHandler::class,
                        'options' => [
                            'path'   => 'data/log/application.log',
                            'level'  => Logger::DEBUG,
                        ],
                    ],
                    'fire_php' => [
                        'name' => FirePHPHandler::class,
                    ],
                ],
            ],
        ],
    ],
];
```

### Using processors

[](#using-processors)

If you want to add extra information (tags, user IP, ...) to the records before they are handled, you should add some processors. The code above adds two processors that add an unique identifier and the current request URI, request method and client IP to a log record.

```
return [
    'monolog' => [
        'loggers' => [
            'Log\App' => [
                'name' => 'default',
                'handlers' => [
                    'default' => [
                        'name' => StreamHandler::class,
                        'options' => [
                            'path'   => 'data/log/application.log',
                            'level'  => Logger::DEBUG,
                        ],
                    ],
                ],
                'processors' => [
                    UidProcessor::class,
                    WebProcessor::class,
                ],
            ],
        ],
    ],
];
```

You can also add processors to a specific handler.

```
return [
    'monolog' => [
        'loggers' => [
            'Log\App' => [
                'name' => 'default',
                'handlers' => [
                    'default' => [
                        'name' => StreamHandler::class,
                        'options' => [
                            'path'   => 'data/log/application.log',
                            'level'  => Logger::DEBUG,
                        ],
                        'processors' => [
                            UidProcessor::class,
                            WebProcessor::class,
                        ],
                    ],
                ],
            ],
        ],
    ],
];
```

### Retrieving a logger

[](#retrieving-a-logger)

Once the configuration is complete, you can retrieve an instance of the logger as below:

```
$logger = $serviceManager->get('Log\App');
$logger->debug('debug message');
```

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

Credits
-------

[](#credits)

- [Nicolas Eeckeloo](https://github.com/neeckeloo)
- [All Contributors](https://github.com/RiskioFr/monolog-module/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/RiskioFr/monolog-module/blob/master/LICENSE) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 97.2% 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 ~266 days

Recently: every ~221 days

Total

12

Last Release

1269d ago

Major Versions

v0.5.0 → v1.0.02020-06-27

PHP version history (6 changes)v0.1.0PHP &gt;=5.4

v0.3.0PHP ^5.6 || ^7.0

v0.5.0PHP ^7.0

v1.0.0PHP ^7.1

v1.1.0PHP &gt;=7.2

v1.2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1768645?v=4)[Nicolas Eeckeloo](/maintainers/neeckeloo)[@neeckeloo](https://github.com/neeckeloo)

---

Top Contributors

[![neeckeloo](https://avatars.githubusercontent.com/u/1768645?v=4)](https://github.com/neeckeloo "neeckeloo (70 commits)")[![arjanvdbos](https://avatars.githubusercontent.com/u/2431008?v=4)](https://github.com/arjanvdbos "arjanvdbos (1 commits)")[![kris-sum](https://avatars.githubusercontent.com/u/2246940?v=4)](https://github.com/kris-sum "kris-sum (1 commits)")

---

Tags

laminaloggingmonologloglaminasloggermonolog

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/neeckeloo-monolog-module/health.svg)

```
[![Health](https://phpackages.com/badges/neeckeloo-monolog-module/health.svg)](https://phpackages.com/packages/neeckeloo-monolog-module)
```

###  Alternatives

[theorchard/monolog-cascade

Monolog extension to configure multiple loggers in the blink of an eye and access them from anywhere

1482.2M9](/packages/theorchard-monolog-cascade)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)[bitrix-expert/monolog-adapter

Monolog adapter for Bitrix CMS

6566.3k](/packages/bitrix-expert-monolog-adapter)[egeniq/monolog-gdpr

Some Monolog processors that will help in relation to the security requirements under GDPR.

528.7k](/packages/egeniq-monolog-gdpr)[glopgar/monolog-timer-processor

A processor for Monolog that adds timing info to the message contexts

1469.6k](/packages/glopgar-monolog-timer-processor)

PHPackages © 2026

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