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

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

altelma/laravel-prometheus-exporter
===================================

A Prometheus exporter for Laravel and Lumen

v0.0.5(3y ago)113.4k↑15.5%MITPHPPHP &gt;=7.4

Since Jan 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ALTELMA/laravel-prometheus-exporter)[ Packagist](https://packagist.org/packages/altelma/laravel-prometheus-exporter)[ RSS](/packages/altelma-laravel-prometheus-exporter/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Laravel Prometheus Exporter
===========================

[](#laravel-prometheus-exporter)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Latest Version on Packagist](https://camo.githubusercontent.com/97b66d73d17b504c54a5cbcd88cbff527315d4e93df95fbfaf631a5243946334/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c74656c6d612f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/altelma/laravel-prometheus-exporter)[![Total Downloads](https://camo.githubusercontent.com/3584bc9214131ffa3affdef35613431d38a37e9975ec6111430bf0cb6e128911/68747470733a2f2f706f7365722e707567782e6f72672f414c54454c4d412f6c61726176656c2d70726f6d6574686575732d6578706f727465722f642f746f74616c2e737667)](https://packagist.org/packages/altelma/laravel-prometheus-exporter)

A prometheus exporter package for Laravel and Lumen.

This package is a wrapper bridging [promphp/prometheus\_client\_php](https://github.com/PromPHP/prometheus_client_php) into Laravel and Lumen.

However, This package get inspire from another package below

- [Superbalist/laravel-prometheus-exporter](https://github.com/Superbalist/laravel-prometheus-exporter)
- [arquivei/laravel-prometheus-exporter](https://github.com/arquivei/laravel-prometheus-exporter)
- [triadev/LaravelPrometheusExporter](https://github.com/triadev/LaravelPrometheusExporter)

Feel free to use above package instead, because this package just try to cover compatibility for previous version of Laravel and Lumen such as 6.x to 8.x, etc.

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

[](#installation)

Install the package via composer

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

If you are using Lumen need to register the service provider in `bootstrap/app.php`

```
$app->register(Altelma\LaravelPrometheusExporter\PrometheusServiceProvider::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_COLLECT_FULL_SQL_QUERY=true
PROMETHEUS_STORAGE_ADAPTER=memory

PROMETHEUS_REDIS_HOST=localhost
PROMETHEUS_REDIS_PORT=6379
PROMETHEUS_REDIS_TIMEOUT=0.1
PROMETHEUS_REDIS_READ_TIMEOUT=10
PROMETHEUS_REDIS_PERSISTENT_CONNECTIONS=0
PROMETHEUS_REDIS_PREFIX=PROMETHEUS_
```

### Metrics with multiple pods in k8s

[](#metrics-with-multiple-pods-in-k8s)

If you want to expose metrics endpoint with application that running in k8s. It needs to store the same information with a single endpoint. So you need to add config like below

```
PROMETHEUS_REDIS_NAME=""
```

You need to ensure config set like this and this support `Redis` adapter only

```
PROMETHEUS_REDIS_PREFIX_DYNAMIC=true
PROMETHEUS_REDIS_PREFIX=
PROMETHEUS_REDIS_NAME=""
```

Metrics
-------

[](#metrics)

The package allows you to observe metrics on the application routes. Metrics on request method, request path and status code.

### Laravel

[](#laravel)

In order to observe metrics in Laravel application routes (the time between a request and response), you should register the following middleware in your application's `app/Http/Kernel.php`:

```
protected $middleware = [
    \Altelma\LaravelPrometheusExporter\Middleware\PrometheusLaravelMiddleware::class,
];
```

### Lumen 9.x

[](#lumen-9x)

In order to observe metrics in Lumen application routes (the time between a request and response), you should register the following middleware in your application's `bootstrap/app.php`:

```
$app->middleware([
    \Altelma\LaravelPrometheusExporter\Middleware\PrometheusLumenMiddleware::class,
]);
```

### Lumen 8.x and Lower

[](#lumen-8x-and-lower)

In Lumen 8.x and lower, cannot get route in global middleware just need to do in route middleware instead

```
$app->routeMiddleware([
    'http.prometheus' => \Altelma\LaravelPrometheusExporter\Middleware\PrometheusLumenRouteMiddleware::class,
]);
```

Protect metrics endpoint
------------------------

[](#protect-metrics-endpoint)

If you need to prevent someone see your routes in `/metrics` you can add middleware to protect your endpoint. Now we start to support only basic\_auth to protect you metrics endpoint

```
PROMETHEUS_METRICS_ROUTE_AUTH_ENABLED=true
PROMETHEUS_METRICS_ROUTE_AUTH_USERNAME=
PROMETHEUS_METRICS_ROUTE_AUTH_PASSWORD=
```

สนับสนุนผมได้นะ ☕
-----------------

[](#สนับสนุนผมได้นะ-)

สวัสดีเพื่อนๆ ทุกคนนะครับ หากมีข้อเสนอแนะอะไร แนะนำมาได้นะครับ นอกจากนี้ เพื่อนๆ สามารถแวะไปอ่านบทความของผมเพิ่มเติมได้ [ที่นี่](https://medium.com/@altelma) ครับ

Bug Report
----------

[](#bug-report)

This package is not perfect right, but can be improve together. If you found bug or have any suggestion. Send that to me or new issue. Thank you to use it.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

5

Last Release

1270d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4938568?v=4)[Phongthorn](/maintainers/ALTELMA)[@ALTELMA](https://github.com/ALTELMA)

---

Top Contributors

[![ALTELMA](https://avatars.githubusercontent.com/u/4938568?v=4)](https://github.com/ALTELMA "ALTELMA (8 commits)")

---

Tags

phplaravelprometheus

### Embed Badge

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

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

###  Alternatives

[lkaemmerling/laravel-horizon-prometheus-exporter

A small package to gain and export long time information from Laravel &amp; Horizon for Prometheus.

1622.2M](/packages/lkaemmerling-laravel-horizon-prometheus-exporter)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renoki-co/octane-exporter

Export Laravel Octane metrics using this Prometheus exporter.

30128.9k](/packages/renoki-co-octane-exporter)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

65108.9k](/packages/masterro-laravel-mail-viewer)

PHPackages © 2026

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