PHPackages                             machour/yii2-prometheus - 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. machour/yii2-prometheus

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

machour/yii2-prometheus
=======================

Prometheus exporter for Yii 2

2.0.1(4y ago)43.4k—0%BSD-3-ClausePHPPHP &gt;=5.4

Since Oct 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/machour/yii2-prometheus)[ Packagist](https://packagist.org/packages/machour/yii2-prometheus)[ RSS](/packages/machour-yii2-prometheus/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

yii2-prometheus
===============

[](#yii2-prometheus)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Prometheus Extension for Yii 2
==============================

[](#prometheus-extension-for-yii-2)

This extension provides a [Prometheus](https://prometheus.io/) exporter component for [Yii framework 2.0](http://www.yiiframework.com) applications.

This extension uses the [textfile collector of Node Exporter](https://github.com/prometheus/node_exporter#textfile-collector) for Prometheus.

[![Latest Stable Version](https://camo.githubusercontent.com/49c0b2e21bb10debb14f997b7fa5afd7edad3285c9a5a4728dbf4e69ed5bdd0c/68747470733a2f2f706f7365722e707567782e6f72672f6d6163686f75722f796969322d70726f6d6574686575732f762f737461626c652e706e67)](https://packagist.org/packages/machour/yii2-prometheus)[![Total Downloads](https://camo.githubusercontent.com/9ce97bf6b14b6782dfa0098e3153ddb891fb5ec917f03aff83c0063f3d2d590a/68747470733a2f2f706f7365722e707567782e6f72672f6d6163686f75722f796969322d70726f6d6574686575732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/machour/yii2-prometheus)[![Build Status](https://github.com/machour/yii2-prometheus/workflows/tests/badge.svg)](https://github.com/machour/yii2-prometheus/actions)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

```
composer require --prefer-dist machour/yii2-prometheus

```

Configuration
-------------

[](#configuration)

In order to exploit the metrics files generated by this extension, you must run the node exporter using the `--collector.textfile.directory` flag, and point it to a valid directory.

If using systemd to manage your scrappers, your `node_exporter.service` file may look something like this:

```
node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/lib/node_exporter/textfile_collector  --web.listen-address="127.0.0.1:9100"

[Install]
WantedBy=default.target

```

Once the extension is installed, simply modify your application configuration as follows:

```
return [
    'components' => [
        'prometheusExporter' => [
            'class' => 'machour\yii2\prometheus\components\Exporter',

            // Point this to your collector directory. Defaults to '/var/lib/node_exporter/textfile_collector/'
            // 'collectorDir' => '/var/lib/node_exporter/textfile_collector/',

            // The default prom file to create if not specified in exportMetric()
            // 'defaultFile' => 'yii2-prometheus-exporter.prom',
        ],
        // ...
    ],
    ...
];
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

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

Every ~1 days

Total

4

Last Release

1662d ago

Major Versions

1.0.1 → 2.0.02021-10-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/50430982793b695a5a9a886a81b976606c71062b49cf38c12509801b1845b1b2?d=identicon)[machour](/maintainers/machour)

---

Top Contributors

[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (12 commits)")

---

Tags

yii2componentprometheusgrafana

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/machour-yii2-prometheus/health.svg)

```
[![Health](https://phpackages.com/badges/machour-yii2-prometheus/health.svg)](https://phpackages.com/packages/machour-yii2-prometheus)
```

###  Alternatives

[bedezign/yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.

201657.4k4](/packages/bedezign-yii2-audit)[mito/yii2-sentry

Yii 2 extension for Sentry

92377.7k](/packages/mito-yii2-sentry)

PHPackages © 2026

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