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

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

tamert/monolog-loki
===================

Monolog handler for Grafana Loki (PHP 7.2 compatible)

0153↓87.5%PHP

Since Nov 17Pushed 7mo agoCompare

[ Source](https://github.com/tamert/monolog-loki)[ Packagist](https://packagist.org/packages/tamert/monolog-loki)[ RSS](/packages/tamert-monolog-loki/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)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.

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

[](#table-of-contents)

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

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

[](#installation)

Require the package via Composer:

```
composer require tamert/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 Tamert\Monolog\Loki\LokiHandler;

$handler = new LokiHandler(
    'http://your-loki-host:3100',
    ['app'=>'My application', 'env'=>'production'],
    '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.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance44

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1997933?v=4)[Tamer Ağaoğlu](/maintainers/tamert)[@tamert](https://github.com/tamert)

---

Top Contributors

[![filtresizkahve](https://avatars.githubusercontent.com/u/103409436?v=4)](https://github.com/filtresizkahve "filtresizkahve (2 commits)")

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M276](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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