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)

0120↓50%PHP

Since Nov 17Pushed 5mo 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 1mo ago

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

21

—

LowBetter than 19% of packages

Maintenance48

Moderate activity, may be stable

Popularity13

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://www.gravatar.com/avatar/b82e2c7fa66b8e78a563cde03ba57218e52e378f27706b7e3fb4d16229329c35?d=identicon)[tamert](/maintainers/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.2B9.1k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M137](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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