PHPackages                             bnomei/kirby3-monolog - 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. bnomei/kirby3-monolog

ActiveKirby-plugin[Logging &amp; Monitoring](/categories/logging)

bnomei/kirby3-monolog
=====================

Use Monolog to log data to files/databases/notifications/...

5.0.1(8mo ago)214.0k—0%MITPHPPHP &gt;=8.2CI passing

Since Oct 27Pushed 8mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (19)Used By (0)

Kirby Monolog
=============

[](#kirby-monolog)

[![Kirby 5](https://camo.githubusercontent.com/b1a1b2ccd58e96259a9722c2489d91f40378c01b6c4c3e9fd27ed1d12c269d7c/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f4b697262792f353f636f6c6f723d454343373438)](https://getkirby.com)[![PHP 8.2](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)[![Release](https://camo.githubusercontent.com/74176c4e3caa15f1b4df6f09547170615fed70ff2b5d83514f57bec89952b936/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/74176c4e3caa15f1b4df6f09547170615fed70ff2b5d83514f57bec89952b936/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)[![Downloads](https://camo.githubusercontent.com/a4a267dc1d80ee1407383a7d83c9fe815a8b8d37561103d135d2bf97cbef4390/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f636f6c6f723d3237323832322669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/a4a267dc1d80ee1407383a7d83c9fe815a8b8d37561103d135d2bf97cbef4390/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f636f6c6f723d3237323832322669636f6e3d676974687562266c6162656c)[![Coverage](https://camo.githubusercontent.com/995a2fd04b01e6d7b65250c54a36cb0b95721fd087dff1c059ef9591b1d82be9/68747470733a2f2f666c61742e62616467656e2e6e65742f636f6465636c696d6174652f636f7665726167652f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f69636f6e3d636f6465636c696d617465266c6162656c)](https://codeclimate.com/github/bnomei/kirby3-monolog)[![Maintainability](https://camo.githubusercontent.com/6c1968b192a17b15ca349c366c9d7b169ce4708f517ca813012ffc8f7a9c0f76/68747470733a2f2f666c61742e62616467656e2e6e65742f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f626e6f6d65692f6b69726279332d6d6f6e6f6c6f673f69636f6e3d636f6465636c696d617465266c6162656c)](https://codeclimate.com/github/bnomei/kirby3-monolog/issues)[![Discord](https://camo.githubusercontent.com/36eaef1b06f4996feb7587aa3281dcbd658e57535bc6b5e10110ed108e7a7a03/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f646973636f72642f626e6f6d65693f636f6c6f723d3732383964612669636f6e3d646973636f7264266c6162656c)](https://discordapp.com/users/bnomei)[![Buymecoffee](https://camo.githubusercontent.com/62e55d1129b82bf9c2fd4656451e81ab87a9787e7c9676ca58276532ed9666ee/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f69636f6e2f646f6e6174653f69636f6e3d6275796d6561636f6666656526636f6c6f723d464638313346266c6162656c)](https://www.buymeacoffee.com/bnomei)

Use Monolog to log data to files/databases/notifications/...

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

[](#installation)

- unzip [master.zip](https://github.com/bnomei/kirby3-monolog/archive/master.zip) as folder `site/plugins/kirby3-monolog` or
- `git submodule add https://github.com/bnomei/kirby3-monolog.git site/plugins/kirby3-monolog` or
- `composer require bnomei/kirby3-monolog`

Quickstart
----------

[](#quickstart)

**site/templates/home.php**

```
monolog()->info('test-' . md5((string) time()), [
    'title' => $page->title(), // field will be normalized
    'page' => $page->id(),
]);
```

**site/logs/2024-10-27.log**

```
[2024-10-27 19:10:30] default.INFO: test-d4a22afc0f735f551748d17c959b3339 {"title":"Home","page":"home"} []

```

**Page-Method**This plugin also registers a Page-Method which will use the UUID of the page as a `channel`. You can use it like this:

```
$page->monolog()->info('test-' . md5((string) time()), [/*...*/]);
```

**site/logs/2024-10-27.log**

```
[2024-10-27 19:10:30] {UUID_of_page}.INFO: test-d4a22afc0f735f551748d17c959b3339 {} []

```

Setup
-----

[](#setup)

Use the [default channel](https://github.com/bnomei/kirby3-monolog/blob/master/index.php#L11) provided by this plugin or define your own *Channels*. Monolog comes bundled with a lot of handlers, formatters and processors.

- write to file or syslogs
- send mails
- post to Slack/Discord
- insert into local or remote databases
- format as JSON
- append file/class/method Introspection
- append a UUID
- append URI, post method and IP
- ... create your own

Usecase
-------

[](#usecase)

### Named Channel =&gt; Logger

[](#named-channel--logger)

```
// write to channel 'default' which writes to file
// defined at 'bnomei.monolog.file' callback
$log = \Bnomei\Log::singleton()->channel('default');
// is same as
$log = monolog('default');
// or simply
$log = monolog();

// get a logger instance by channel by name
$securityLogger = monolog('security');
```

### Add records to the Logger

[](#add-records-to-the-logger)

#### Message

[](#message)

```
$log = monolog();
$log->warning('Foo');

// or with method chaining
monolog()->error('Bar');
```

#### Message and Context

[](#message-and-context)

```
monolog()->info('Adding a new user', [
    'username' => $user->name(),
]);

// increment Field `visits` in current Page
$page = $page->increment('visits');
monolog()->info('Incrementing Field', [
    'page' => $page->id(),
    'visits' => $page->visits()->toInt(),
]);
```

Default Channel
---------------

[](#default-channel)

The [default channel](https://github.com/bnomei/kirby3-monolog/blob/master/index.php#L11) provided by this plugin writes file to the `site/logs` folder. It will be using the filename format `date('Y-m-d') . '.log'` and [normalizes the data](https://github.com/bnomei/kirby3-monolog/blob/master/classes/KirbyFormatter.php) to make logging Kirby Objects easier.

Note

Without that normalization you would have to call `->value()` or cast as `string` on every Kirby Field before adding its value as context data.

Custom Channel
--------------

[](#custom-channel)

**site/config/config.php**

```
return [
    // other config settings ...
    // (optional) add custom channels
    'bnomei.monolog.channels' => [
        'security' => function() {
            $logger = new \Monolog\Logger('security');
            // add handlers, formatters, processors and then...
            return $logger;
        }
    ],
];
```

Custom Channel Extends
----------------------

[](#custom-channel-extends)

**site/config/config.php**

```
return [
    // other config settings ...
    // (optional) add custom channels from other plugins
    'bnomei.monolog.channels.extends' => [
        'myplugin.name.channels', // array of channel definitions in your other option
    ],
];
```

Dependencies
------------

[](#dependencies)

- [seldaek/monolog](https://github.com/seldaek/monolog)

Disclaimer
----------

[](#disclaimer)

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/bnomei/kirby3-monolog/issues/new).

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance58

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity79

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

Recently: every ~214 days

Total

18

Last Release

268d ago

Major Versions

1.2.3 → 2.0.02021-02-24

2.0.4 → 3.0.02024-11-18

3.0.0 → 5.0.02024-11-28

PHP version history (3 changes)1.0.0PHP &gt;=7.2.0

2.0.2PHP &gt;=8.0

5.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3265642?v=4)[Bruno Meilick](/maintainers/bnomei)[@bnomei](https://github.com/bnomei)

---

Top Contributors

[![bnomei](https://avatars.githubusercontent.com/u/3265642?v=4)](https://github.com/bnomei "bnomei (46 commits)")

---

Tags

formattershandlerskirbykirby-cmskirby-pluginkirby4kirby5loglog-fileloggingmonologprocessorspsr-3wrapperslogpsr-3loggingmonologlog filewrapperskirbykirby-pluginkirby-cmsformattershandlersprocessors

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bnomei-kirby3-monolog/health.svg)

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

###  Alternatives

[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)[filips123/monolog-phpmailer

PHPMailer handler for Monolog

1365.6k3](/packages/filips123-monolog-phpmailer)[inpsyde/logzio-monolog

Logz.io integration for Monolog

191.2M1](/packages/inpsyde-logzio-monolog)[mero/yii2-monolog

The Monolog integration for the Yii framework.

42186.1k](/packages/mero-yii2-monolog)[alexandre-daubois/monolog-processor-collection

A collection of Monolog processors

1516.6k](/packages/alexandre-daubois-monolog-processor-collection)

PHPackages © 2026

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