PHPackages                             satariall/laravel-prometheus-exporter - 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. satariall/laravel-prometheus-exporter

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

satariall/laravel-prometheus-exporter
=====================================

A prometheus exporter for Laravel

2.0(2y ago)15.6k1MITPHPPHP ^8.1

Since Jul 27Pushed 2y agoCompare

[ Source](https://github.com/Satariall/laravel-prometheus-exporter)[ Packagist](https://packagist.org/packages/satariall/laravel-prometheus-exporter)[ RSS](/packages/satariall-laravel-prometheus-exporter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (13)Used By (0)

❗ Temporary fork ❗
==================

[](#exclamation-temporary-fork-exclamation)

This is a temporary fork from  originally forked from . It will live before the original project modify the original Prometheus client from the abandoned package Jimdo/prometheus\_client\_php to endclothing/prometheus\_client\_php. Right now I need this to prevent blocking the current CI/CD process for live projects.

laravel-prometheus-exporter
===========================

[](#laravel-prometheus-exporter)

A prometheus exporter for Laravel.

[![Author](https://camo.githubusercontent.com/abd4e3e2e71081ad01ef09a60c49d70c5e0677497f38918e740703cd02605078/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40737570657262616c6973742d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/superbalist)[![Build Status](https://camo.githubusercontent.com/b168d433e37f92f236c1035240519c98c7da80e1a1c3c35eca382ca88377fbfb/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f537570657262616c6973742f6c61726176656c2d70726f6d6574686575732d6578706f727465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Superbalist/laravel-prometheus-exporter)[![StyleCI](https://camo.githubusercontent.com/777454aa482b127763ef812e6f66c1d55121c91b349038e78dc0c5ee86127137/68747470733a2f2f7374796c6563692e696f2f7265706f732f39383531363831342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/98516814)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/db7c8269f2b10622cf7e8156a036f090d3fbb415683b06dbe6c172c34e50f87b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737570657262616c6973742f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/laravel-prometheus-exporter)[![Total Downloads](https://camo.githubusercontent.com/2069cc518790bed3b9da67586e17e9d8427bda54bea34c642386b9774997ebc9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737570657262616c6973742f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superbalist/laravel-prometheus-exporter)

This package is a wrapper bridging [jimdo/prometheus\_client\_php](https://github.com/Jimdo/prometheus_client_php) into Laravel.

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

[](#installation)

```
composer require superbalist/laravel-prometheus-exporter
```

Register the service provider in app.php

```
'providers' => [
    // ...
    Superbalist\LaravelPrometheusExporter\PrometheusServiceProvider::class,
]
```

Register the facade in app.php

```
'aliases' => [
    // ...
    'Prometheus' => Superbalist\LaravelPrometheusExporter\PrometheusFacade::class,
]
```

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

[](#configuration)

The package has a default configuration which uses the following environment variables.

```
PROMETHEUS_NAMESPACE=app

PROMETHEUS_METRICS_ROUTE_ENABLED=true
PROMETHEUS_METRICS_ROUTE_PATH=metrics
PROMETHEUS_METRICS_ROUTE_MIDDLEWARE=null

PROMETHEUS_STORAGE_ADAPTER=memory

REDIS_HOST=localhost
REDIS_PORT=6379
PROMETHEUS_REDIS_PREFIX=PROMETHEUS_

```

To customize the configuration file, publish the package configuration using Artisan.

```
php artisan vendor:publish --provider="Superbalist\LaravelPrometheusExporter\PrometheusServiceProvider"
```

You can then edit the generated config at `app/config/prometheus.php`.

### Storage Adapters

[](#storage-adapters)

The storage adapter is used to persist metrics across requests. The `memory` adapter is enabled by default, meaning data will only be persisted across the current request. We recommend using the `redis` or `apc` adapter in production environments.

The `PROMETHEUS_STORAGE_ADAPTER` env var is used to specify the storage adapter.

If `redis` is used, the `REDIS_HOST` and `REDIS_PORT` vars also need to be configured.

### Exporting Metrics

[](#exporting-metrics)

The package adds a `/metrics` end-point, enabled by default, which exposes all metrics gathered by collectors.

This can be turned on/off using the `PROMETHEUS_METRICS_ROUTE_ENABLED` var, and can also be changed using the `PROMETHEUS_METRICS_ROUTE_PATH` var.

If you would like to protect this end-point, you can write any custom middleware and enable it using `PROMETHEUS_METRICS_ROUTE_MIDDLEWARE`.

### Collectors

[](#collectors)

A collector is a class, implementing the [CollectorInterface](src/CollectorInterface.php), which is responsible for collecting data for one or many metrics.

Please see the [ExampleCollector](src/ExampleCollector.php) included in this repository.

You can auto-load your collectors by adding them to the `collectors` array in the prometheus.php config.

Usage
-----

[](#usage)

```
// retrieve the exporter
$exporter = app(\Superbalist\LaravelPrometheusExporter::class);
// or
$exporter = app('prometheus');
// or
$exporter = Prometheus::getFacadeRoot();

// register a new collector
$collector = new \My\New\Collector();
$exporter->registerCollector($collector);

// retrieve all collectors
var_dump($exporter->getCollectors());

// retrieve a collector by name
$collector = $exporter->getCollector('user');

// export all metrics
// this is called automatically when the /metrics end-point is hit
var_dump($exporter->export());

// the following methods can be used to create and interact with counters, gauges and histograms directly
// these methods will typically be called by collectors, but can be used to register any custom metrics directly,
// without the need of a collector

// create a counter
$counter = $exporter->registerCounter('search_requests_total', 'The total number of search requests.');
$counter->inc(); // increment by 1
$counter->incBy(2);

// create a counter (with labels)
$counter = $exporter->registerCounter('search_requests_total', 'The total number of search requests.', ['request_type']);
$counter->inc(['GET']); // increment by 1
$counter->incBy(2, ['GET']);

// retrieve a counter
$counter = $exporter->getCounter('search_requests_total');

// create a gauge
$gauge = $exporter->registerGauge('users_online_total', 'The total number of users online.');
$gauge->inc(); // increment by 1
$gauge->incBy(2);
$gauge->dec(); // decrement by 1
$gauge->decBy(2);
$gauge->set(36);

// create a gauge (with labels)
$gauge = $exporter->registerGauge('users_online_total', 'The total number of users online.', ['group']);
$gauge->inc(['staff']); // increment by 1
$gauge->incBy(2, ['staff']);
$gauge->dec(['staff']); // decrement by 1
$gauge->decBy(2, ['staff']);
$gauge->set(36, ['staff']);

// retrieve a gauge
$counter = $exporter->getGauge('users_online_total');

// create a histogram
$histogram = $exporter->registerHistogram(
    'response_time_seconds',
    'The response time of a request.',
    [],
    [0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0]
);
// the buckets must be in asc order
// if buckets aren't specified, the default 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0 buckets will be used
$histogram->observe(5.0);

// create a histogram (with labels)
$histogram = $exporter->registerHistogram(
    'response_time_seconds',
    'The response time of a request.',
    ['request_type'],
    [0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0]
);
// the buckets must be in asc order
// if buckets aren't specified, the default 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0 buckets will be used
$histogram->observe(5.0, ['GET']);

// retrieve a histogram
$counter = $exporter->getHistogram('response_time_seconds');
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 53.8% 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 ~192 days

Recently: every ~271 days

Total

12

Last Release

1092d ago

Major Versions

1.1.0 → 2.02023-05-15

PHP version history (3 changes)1.0.0PHP &gt;=5.6.0

1.0.6PHP &gt;=7.1

2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/57b7f94151cd842370a545a9ffcb79962e7f1598169a1c3c8a15d5cd761d1e2a?d=identicon)[Satariall](/maintainers/Satariall)

---

Top Contributors

[![matthewgoslett](https://avatars.githubusercontent.com/u/1571743?v=4)](https://github.com/matthewgoslett "matthewgoslett (14 commits)")[![nicja](https://avatars.githubusercontent.com/u/2102143?v=4)](https://github.com/nicja "nicja (5 commits)")[![lucacri](https://avatars.githubusercontent.com/u/2913531?v=4)](https://github.com/lucacri "lucacri (1 commits)")[![nope7777](https://avatars.githubusercontent.com/u/8977306?v=4)](https://github.com/nope7777 "nope7777 (1 commits)")[![Satariall](https://avatars.githubusercontent.com/u/1109787?v=4)](https://github.com/Satariall "Satariall (1 commits)")[![stefanbauer](https://avatars.githubusercontent.com/u/3192662?v=4)](https://github.com/stefanbauer "stefanbauer (1 commits)")[![adi64](https://avatars.githubusercontent.com/u/5867277?v=4)](https://github.com/adi64 "adi64 (1 commits)")[![zoidyzoidzoid](https://avatars.githubusercontent.com/u/2572493?v=4)](https://github.com/zoidyzoidzoid "zoidyzoidzoid (1 commits)")[![janwehner](https://avatars.githubusercontent.com/u/1687426?v=4)](https://github.com/janwehner "janwehner (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/satariall-laravel-prometheus-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/satariall-laravel-prometheus-exporter/health.svg)](https://phpackages.com/packages/satariall-laravel-prometheus-exporter)
```

###  Alternatives

[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)[melihovv/laravel-log-viewer

A Laravel log viewer

1231.5k1](/packages/melihovv-laravel-log-viewer)

PHPackages © 2026

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