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

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

caikeal/laravel-prometheus-exporter
===================================

A laravel and lumen service provider to export metrics for prometheus.

v2.0.1(5y ago)03.8kMITPHPPHP &gt;=7.1

Since Jul 28Pushed 5y agoCompare

[ Source](https://github.com/caikeal/LaravelPrometheusExporter)[ Packagist](https://packagist.org/packages/caikeal/laravel-prometheus-exporter)[ RSS](/packages/caikeal-laravel-prometheus-exporter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (24)Used By (0)

LaravelPrometheusExporter
=========================

[](#laravelprometheusexporter)

[![Software license](https://camo.githubusercontent.com/0259aa22543ff630a79827cfedede9886eb93e8fd7ea2a089b6ee1330630877d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Travis](https://camo.githubusercontent.com/deefffa22e897ce137a49b82d6e9fcf28c8688e63360953bc958b7478c1ca264/68747470733a2f2f7472617669732d63692e6f72672f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/triadev/LaravelPrometheusExporter)[![Coveralls](https://camo.githubusercontent.com/849d48ddb839360fd501a4566b9b90ef5fdceb8e0921dce4a4b28947fc06428d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/triadev/LaravelPrometheusExporter?branch=master)[![CodeCov](https://camo.githubusercontent.com/95613a520b6ae4877823572a5543acf1fefcc27825a87a00f0d6ba843e3b0d2d/68747470733a2f2f636f6465636f762e696f2f67682f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/triadev/LaravelPrometheusExporter)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/59980a90e6b6eefe0efda554e62fa2fe4401e3d5127e6d431b2abd0474da466c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/triadev/LaravelPrometheusExporter/?branch=master)[![Latest stable](https://camo.githubusercontent.com/7b051809be1d059681b4e68fd606a69abd892918f88abc1fcd98a6878342a957/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747269616465762f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-prometheus-exporter)[![Monthly installs](https://camo.githubusercontent.com/d114db72d49f63382ecfb67ca9d17b7d6475440195b0507df87a8e8f6692b587/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f747269616465762f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-prometheus-exporter/stats)[![Total Downloads](https://camo.githubusercontent.com/20b99a0be43c5f0d068ba54bd162c2195b549461552e4d67e105886006e3cea6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f747269616465762f6c61726176656c2d70726f6d6574686575732d6578706f727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-prometheus-exporter)[![Average time to resolve an issue](https://camo.githubusercontent.com/4ff51e53250e63716716329bbc2eae6fac70700134ec4dee501fc7c5417ae416/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722e737667)](http://isitmaintained.com/project/triadev/LaravelPrometheusExporter "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/b59b7a96aab7d403650c933511f11e1ae812b7373967256da9003da82dedf4a2/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f747269616465762f4c61726176656c50726f6d6574686575734578706f727465722e737667)](http://isitmaintained.com/project/triadev/LaravelPrometheusExporter "Percentage of issues still open")

A laravel and lumen service provider to export metrics for prometheus.

Supported laravel versions
--------------------------

[](#supported-laravel-versions)

[![Laravel 5.6](https://camo.githubusercontent.com/19208e4e17c5a44f6eeb2ca49987cf944b671fbd1069f1e5cc006c509f119e2b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e362d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.7](https://camo.githubusercontent.com/01e109b20d194f8c9f7398bde86682d9457d92fbf7485b4ffabf6746df741d64/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e372d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.8](https://camo.githubusercontent.com/af472893bacd7e92126a6c6eae58acd9e851cedd0b2cd54a9aad91d8c4f7ec95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e382d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 6.0](https://camo.githubusercontent.com/5300b40d51583886319c2fa9c1c83d12e190ca51bd8f7e2e5c0f6f2db055ac56/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d362e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

Supported lumen versions
------------------------

[](#supported-lumen-versions)

[![Lumen 5.6](https://camo.githubusercontent.com/0451870c4e2b90844a1777018707557fd59a8499c034283a3ad7e2b9a80b900a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c756d656e2d352e362d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://lumen.laravel.com)[![Lumen 5.7](https://camo.githubusercontent.com/53153143dd81924774f7ee70963299afbd455ab62329e836745ba406d7b467bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c756d656e2d352e372d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://lumen.laravel.com)[![Lumen 5.8](https://camo.githubusercontent.com/72492fbc773f96c03fded0b6451107ffec8be5c470168ca5db3c3dab1888deb3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c756d656e2d352e382d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://lumen.laravel.com)[![Lumen 6.0](https://camo.githubusercontent.com/a5422785c28641124e53a6cd2e02c09a713290655c58d77007641c58131b13db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c756d656e2d362e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://lumen.laravel.com)

Main features
-------------

[](#main-features)

- Metrics with APC
- Metrics with Redis
- Metrics with InMemory
- Metrics with the push gateway
- Request per route middleware (total and duration metrics)

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

[](#installation)

### Composer

[](#composer)

> composer require triadev/laravel-prometheus-exporter

### Application

[](#application)

The package is registered through the package discovery of laravel and Composer.

>

Once installed you can now publish your config file and set your correct configuration for using the package.

```
php artisan vendor:publish --provider="Triadev\PrometheusExporter\Provider\PrometheusExporterServiceProvider" --tag="config"
```

This will create a file `config/prometheus-exporter.php`.

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

[](#configuration)

KeyEnvValueDescriptionDefaultadapterPROMETHEUS\_ADAPTERSTRINGapc, redis, inmemory or pushapcnamespace---STRINGdefault: appappnamespace\_http---STRINGnamespace for "RequestPerRoute-Middleware metrics"httpredis.connectionPROMETHEUS\_REDIS\_CONNECTIONSTRINGredis connectiondefaultpush\_gateway.addressPROMETHEUS\_PUSH\_GATEWAY\_ADDRESSSTRINGpush gateway addresslocalhost:9091buckets\_per\_route---STRINGhistogram buckets for "RequestPerRoute-Middleware"---### buckets\_per\_route

[](#buckets_per_route)

```
'buckets_per_route' => [
    ROUTE-NAME => [10,20,50,100,200],
    ...
]

```

Usage
-----

[](#usage)

### Get metrics

[](#get-metrics)

#### Laravel

[](#laravel)

When you are using laravel you can use the default http endpoint:

> triadev/pe/metrics

Of course you can also register your own route. Here is an example:

```
Route::get(
    ROUTE,
    \Triadev\PrometheusExporter\Controller\LaravelController::class . '@metrics'
);

```

#### Lumen

[](#lumen)

When you are using lumen you must register the route on your own. Here is an example:

```
Route::get(
    ROUTE,
    \Triadev\PrometheusExporter\Controller\LumenController::class . '@metrics'
);

```

### Middleware

[](#middleware)

#### RequestPerRoute

[](#requestperroute)

A middleware to build metrics for "request\_total" and "requests\_latency\_milliseconds" per route.

##### Alias

[](#alias)

> lpe.requestPerRoute

##### Metrics

[](#metrics)

1. requests\_total (inc)
2. requests\_latency\_milliseconds (histogram)

##### Example

[](#example)

```
$router->get('/test/route', function () {
    return 'valid';
})->middleware('lpe.requestPerRoute');
```

> app\_requests\_latency\_milliseconds\_bucket{route="/test/route",method="GET",status\_code="200",le="0.005"} 0 ... app\_requests\_latency\_milliseconds\_count{route="/test/route",method="GET",status\_code="200"} 1 app\_requests\_latency\_milliseconds\_sum{route="/test/route",method="GET",status\_code="200"} 6 app\_requests\_total{route="/test/route",method="GET",status\_code="200"} 1

Roadmap
-------

[](#roadmap)

- histogram buckets per route (RequestPerRoute)

Reporting Issues
----------------

[](#reporting-issues)

If you do find an issue, please feel free to report it with GitHub's bug tracker for this project.

Alternatively, fork the project and make a pull request. :)

Testing
-------

[](#testing)

1. docker-compose up
2. docker exec fpm ./vendor/phpunit/phpunit/phpunit

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Christopher Lorke](https://github.com/triadev)
- [All Contributors](../../contributors)

Other
-----

[](#other)

### Project related links

[](#project-related-links)

- [Wiki](https://github.com/triadev/LaravelPrometheusExporter/wiki)
- [Issue tracker](https://github.com/triadev/LaravelPrometheusExporter/issues)

### Author

[](#author)

- [Christopher Lorke](mailto:christopher.lorke@gmx.de)

### License

[](#license)

The code for LaravelPrometheusExporter is distributed under the terms of the MIT license (see [LICENSE](LICENSE)).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~54 days

Recently: every ~117 days

Total

23

Last Release

2024d ago

Major Versions

v1.9.0 → v2.0.02020-10-26

PHP version history (3 changes)v1.0.0PHP &gt;=7.0

v1.3.0PHP &gt;=7.1

v1.8.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/90054c6ceecc7344184d557c5100f1cded77eb8b52964a65fecb7ae4547a9d17?d=identicon)[caikeal](/maintainers/caikeal)

---

Top Contributors

[![triadev](https://avatars.githubusercontent.com/u/10552858?v=4)](https://github.com/triadev "triadev (21 commits)")[![martianoff](https://avatars.githubusercontent.com/u/7222812?v=4)](https://github.com/martianoff "martianoff (1 commits)")[![MyIgel](https://avatars.githubusercontent.com/u/1448057?v=4)](https://github.com/MyIgel "MyIgel (1 commits)")

---

Tags

laravelMetricsprometheus

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/caikeal-laravel-prometheus-exporter/health.svg)](https://phpackages.com/packages/caikeal-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.

1602.0M](/packages/lkaemmerling-laravel-horizon-prometheus-exporter)[triadev/laravel-prometheus-exporter

A laravel and lumen service provider to export metrics for prometheus.

2728.2k1](/packages/triadev-laravel-prometheus-exporter)

PHPackages © 2026

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