PHPackages                             kibatic/prometheus-metrics-builder - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kibatic/prometheus-metrics-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kibatic/prometheus-metrics-builder
==================================

Library that helps to build prometheus metrics

v1.0.1(3y ago)12MITPHPPHP ^8.0.2 || ^7.4.0

Since Nov 21Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (4)Used By (0)

Prometheus Metrics Builder
==========================

[](#prometheus-metrics-builder)

[![example workflow](https://github.com/kibatic/PrometheusMetricsBuilder/actions/workflows/php.yml/badge.svg)](https://github.com/kibatic/PrometheusMetricsBuilder/actions/workflows/php.yml/badge.svg)

This library helps you to build a Prometheus metrics endpoint for your PHP application.

Quick start
-----------

[](#quick-start)

### Install the library

[](#install-the-library)

```
composer require kibatic/prometheus-metrics-builder
```

### Basic usage

[](#basic-usage)

```
$metricList = new MetricList();
$metricList->addMetric(new Metric('foo', 1));
$metricList->addMetric(new Metric('bar', "NaN"));
$metricList->addMetric(new Metric(
    'bar',
    1.35,
    [
        'label1' => 'value1',
        'label2' => 'value2',
    ]
));
$response = $metricList->getResponseContent();
$metricList->clearMetrics();
```

The content of the response will be:

```
foo 1
bar NaN
bar{label1="value1",label2="value2"} 1.35

```

More advanced usage
-------------------

[](#more-advanced-usage)

### attributes

[](#attributes)

```
$metric = new Metric(
    'my_metric_name',
    12,
    [
        'module' => 'invoice',
        'instance' => 'value2',
    ],
    new \DateTimeImmutable()
)
```

### timestamp with miliseconds

[](#timestamp-with-miliseconds)

```
$metric = new Metric(
    'foo',
    1,
    [],
    new \DateTimeImmutable('2020-01-01 00:00:00.012')
);
```

For developpeurs
----------------

[](#for-developpeurs)

### Run tests

[](#run-tests)

```
# install all the needed dependencies
make composer

# run unit tests
make test
```

Roadmap
-------

[](#roadmap)

- no plan for the moment

Versions
--------

[](#versions)

2022-11-21 : v1.0.1

- add CI with github actions

2022-11-21 : v1.0.0

- initial version

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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 ~0 days

Total

2

Last Release

1265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95c1423b83010cc8afd1fc966d26cc6fc5d7fb5d000e5d7582adcd8392bd239c?d=identicon)[kitpages](/maintainers/kitpages)

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

---

Top Contributors

[![philippe-levan](https://avatars.githubusercontent.com/u/393066?v=4)](https://github.com/philippe-levan "philippe-levan (14 commits)")

---

Tags

phpMetricsexporterprometheus

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kibatic-prometheus-metrics-builder/health.svg)

```
[![Health](https://phpackages.com/badges/kibatic-prometheus-metrics-builder/health.svg)](https://phpackages.com/packages/kibatic-prometheus-metrics-builder)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)[renoki-co/octane-exporter

Export Laravel Octane metrics using this Prometheus exporter.

30128.9k](/packages/renoki-co-octane-exporter)[renoki-co/horizon-exporter

Export Laravel Horizon metrics using this Prometheus exporter.

24152.7k](/packages/renoki-co-horizon-exporter)

PHPackages © 2026

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