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

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

understand/understand-monolog
=============================

Understand.io Monolog package.

v1.0.0(10y ago)22.4k↓66.7%1MITPHPPHP &gt;=5.4.0

Since Oct 21Pushed 10y ago2 watchersCompare

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

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

Monolog Understand.io handler
=============================

[](#monolog-understandio-handler)

[![Build Status](https://camo.githubusercontent.com/ccc683e6f54cfe571bc59e74e47ab934451de89fac79847875f1240d182919bc/68747470733a2f2f7472617669732d63692e6f72672f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672e737667)](https://travis-ci.org/understand/understand-monolog)[![Latest Stable Version](https://camo.githubusercontent.com/19ba41c3613e920f7451136cc60b513028d8fe216850ee6565a984907bf882d9/68747470733a2f2f706f7365722e707567782e6f72672f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672f762f737461626c652e737667)](https://packagist.org/packages/understand/understand-monolog)[![Latest Unstable Version](https://camo.githubusercontent.com/667eea0c9da59fecc8eb34c8de6616f385279582cd153c56e999cf4adf222ef0/68747470733a2f2f706f7365722e707567782e6f72672f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672f762f756e737461626c652e737667)](https://packagist.org/packages/understand/understand-monolog)[![License](https://camo.githubusercontent.com/e2208ac098913627f6648f735058cc15ca2252230201739d17372b742a300c2f/68747470733a2f2f706f7365722e707567782e6f72672f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672f6c6963656e73652e737667)](https://packagist.org/packages/understand/understand-monolog)[![HHVM Status](https://camo.githubusercontent.com/8d5effb9e4433d3b4107832972a783d631cf2e504abb1d00433786cadbc1adb3/687474703a2f2f6868766d2e683463632e64652f62616467652f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672e737667)](http://hhvm.h4cc.de/package/understand/understand-monolog)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a2c9083a759bf2042dbd2041c9a5415650b8c2d2e581944ccddb18a2e5e92748/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f756e6465727374616e642f756e6465727374616e642d6d6f6e6f6c6f672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/understand/understand-monolog/?branch=master)

### Introduction

[](#introduction)

This package provides a [Monolog](https://github.com/Seldaek/monolog) handler and formatter for log data delivery to [Understand.io](https://www.understand.io).

> You may also be interested in our [Laravel 4](https://github.com/understand/understand-laravel), [Laravel 5](https://github.com/understand/understand-laravel5) or [Laravel Lumen service provider handler](https://github.com/understand/understand-lumen)

### Quick start

[](#quick-start)

1. Install package

```
composer require understand/understand-monolog

```

2. Add an Understand handler to Monolog

```
use Monolog\Logger;

// input token from Understand.io
$inputToken = 'ab1cd234-1234-45e6-789f-gh1fa1234567';

// choose a handler, either async or sync (see below)
$understandAsyncHandler = new UnderstandMonolog\Handler\UnderstandAsyncHandler($inputToken); // async handler
$understandSyncHandler = new UnderstandMonolog\Handler\UnderstandSyncHandler($inputToken); // sync handler

$monologLogger = new Logger('name');
$monologLogger->pushHandler($understandAsyncHandler); // or $understandSyncHandler

$monologLogger->addError('first error');
```

### Handlers

[](#handlers)

##### UnderstandSyncHandler

[](#understandsynchandler)

The sync handler uses the [PHP Curl](http://php.net/manual/en/book.curl.php) extension and delivers logs synchronously to Understand.io. This means that if your application generates a large amount of data it could slow down your app.

##### UnderstandAsyncHandler

[](#understandasynchandler)

We recommend making use of the `async` handler where possible. It is supported in most systems - the only requirement is that CURL command line tool is installed and functioning correctly. To check whether CURL is available on your system, execute the following command in your console

```
curl -h

```

If you see instructions on how to use CURL then your system has the CURL binary installed and you can use the async handler.

### Exception encoder

[](#exception-encoder)

This helper class allows you to serialize PHP exceptions as an array which can be then serialized to json. The main benefit of doing this is that Understand will then be able to parse your logs more intelligently, allowing for better search and filtering capabilities.

```
$exception = new \DomainException('This is Exception', 123);

$encoder = new \UnderstandMonolog\Encoder\ExceptionEncoder();
$array = $encoder->exceptionToArray($exception);

print_r($array);exit;

//Array
//(
//    [message] => This is Exception
//    [class] => DomainException
//    [code] => 123
//    [file] => /home/vagrant/share/understand-lumen-test/app/Exceptions/Handler.php
//    [line] => 30
//    [stack] => Array
//        (
//            [0] => Array
//                (
//                    [class] => App\Exceptions\Handler
//                    [function] => report
//                    [args] => Array
//                        (
//                            [0] => DomainException
//                        )
//
//                    [type] => method
//                    [file] => /home/vagrant/share/understand-lumen-test/vendor/laravel/lumen-framework/src/Application.php
//                    [line] => 354
// .......... and more
```

#### How to use the Exception encoder

[](#how-to-use-the-exception-encoder)

```
use Monolog\Logger;

// input token from Understand.io
$inputToken = 'ab1cd234-1234-45e6-789f-gh1fa1234567';

// choose a handler
$understandAsyncHandler = new UnderstandMonolog\Handler\UnderstandAsyncHandler($inputToken); // async handler

$monologLogger = new Logger('name');
$monologLogger->pushHandler($understandAsyncHandler);

$exception = new \DomainException('This is Exception', 123);

$encoder = new UnderstandMonolog\Encoder\ExceptionEncoder();
$context = $encoder->exceptionToArray($exception);

$monologLogger->addError($exception->getMessage(), $context);
```

### License

[](#license)

The Understand.io Monolog package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% 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 ~6 days

Total

2

Last Release

3857d ago

Major Versions

v0.0.1 → v1.0.02015-10-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/d07aaeb33d6be84336efa41cd2f95339d2971a1da19a77b3d57130607481ef55?d=identicon)[understand](/maintainers/understand)

---

Top Contributors

[![aivis](https://avatars.githubusercontent.com/u/935577?v=4)](https://github.com/aivis "aivis (22 commits)")[![JonoB](https://avatars.githubusercontent.com/u/627725?v=4)](https://github.com/JonoB "JonoB (1 commits)")

---

Tags

logloggingmonologunderstandUnderstand.io

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/understand-understand-monolog/health.svg)](https://phpackages.com/packages/understand-understand-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)[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)[mero/telegram-handler

Monolog handler to send log by Telegram

36113.3k](/packages/mero-telegram-handler)[lefuturiste/monolog-discord-handler

A simple monolog handler for support Discord webhooks

34111.6k4](/packages/lefuturiste-monolog-discord-handler)

PHPackages © 2026

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