PHPackages                             tomas-kulhanek/monolog-loki - 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. tomas-kulhanek/monolog-loki

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

tomas-kulhanek/monolog-loki
===========================

Loki handler for Monolog

v1.0.0(10mo ago)0962↓36.4%1MITPHPPHP &gt;=8.2CI passing

Since Jul 17Pushed 10mo agoCompare

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

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

Loki handler for Monolog
========================

[](#loki-handler-for-monolog)

Loki handler for Monolog, providing a formatter that serializes records into the JSON format expected by Grafana Loki.

[![Latest Version](https://camo.githubusercontent.com/cb753bd37ef414f114bcadedceb68c980fa5af6d498fe4fa8af2b61239a67033/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d61732d6b756c68616e656b2f6d6f6e6f6c6f672d6c6f6b692e737667)](https://packagist.org/packages/tomas-kulhanek/monolog-loki)
[![License](https://camo.githubusercontent.com/c5673ed1508793fd6f801909e95b5b228f6609203628541df0f95efa8bda6b49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6d61732d6b756c68616e656b2f6d6f6e6f6c6f672d6c6f6b692e737667)](LICENSE)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

Require the package via Composer:

```
composer require tomas-kulhanek/monolog-loki
```

Usage
-----

[](#usage)

Below is a minimal example showing how to send logs to a Loki server:

```
use Monolog\Level;
use Monolog\Logger;
use TomasKulhanek\Monolog\Loki\LokiHandler;

$handler = new LokiHandler(
    'http://your-loki-host:3100',
    'username',
    'password',
    ['app'=>'My application', 'env'=>'production'],
    Level::Debug
);

$logger = new Logger('loki');
$logger->pushHandler($handler);

$logger->info('User signed in', ['user_id' => 123]);
```

[![Grafana explore](docs/grafana_explore.png)](docs/grafana_explore.png)

Contributing
------------

[](#contributing)

Contributions are very welcome! Please:

1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/YourFeature`).
3. Make your changes, ensuring all tests pass and coding standards are met.
4. Submit a pull request.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance54

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

305d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7447745?v=4)[Tomáš Kulhánek](/maintainers/tomas-kulhanek)[@tomas-kulhanek](https://github.com/tomas-kulhanek)

---

Top Contributors

[![tomas-kulhanek](https://avatars.githubusercontent.com/u/7447745?v=4)](https://github.com/tomas-kulhanek "tomas-kulhanek (7 commits)")

---

Tags

logphplogginghandlerloggermonologloki

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomas-kulhanek-monolog-loki/health.svg)

```
[![Health](https://phpackages.com/badges/tomas-kulhanek-monolog-loki/health.svg)](https://phpackages.com/packages/tomas-kulhanek-monolog-loki)
```

###  Alternatives

[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)[inpsyde/wonolog

Monolog-based logging package for WordPress.

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

A Monolog handler and formatter that makes use of the elasticsearch/elasticsearch package

1123.0k](/packages/atrapalo-monolog-elasticsearch)

PHPackages © 2026

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