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

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

gallop-yd/laravel-prometheus-exporter
=====================================

A laravel service provider to export metrics.

0195PHP

Since May 24Pushed 6y agoCompare

[ Source](https://github.com/GallopYD/LaravelPrometheusExporter)[ Packagist](https://packagist.org/packages/gallop-yd/laravel-prometheus-exporter)[ RSS](/packages/gallop-yd-laravel-prometheus-exporter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)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)

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

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

[](#supported-laravel-versions)

[![Laravel 5.5](https://camo.githubusercontent.com/1bd291589054cd0fea96c97b26e57f7dfd024f3d20572a13a74a64e37aa053d6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e352d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.6](https://camo.githubusercontent.com/19208e4e17c5a44f6eeb2ca49987cf944b671fbd1069f1e5cc006c509f119e2b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e362d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.7](https://camo.githubusercontent.com/01e109b20d194f8c9f7398bde86682d9457d92fbf7485b4ffabf6746df741d64/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e372d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://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="GallopYD\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.hostPROMETHEUS\_REDIS\_HOSTSTRINGredis host127.0.0.1redis.portPROMETHEUS\_REDIS\_PORTINTEGERredis port6379redis.timeout---FLOATredis timeout0.1redis.read\_timeout---INTEGERredis read timeout10push\_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)

### Endpoint to get metrics

[](#endpoint-to-get-metrics)

> juhu/pe/metrics

### Middleware

[](#middleware)

#### RequestPerRoute (only laravel)

[](#requestperroute-only-laravel)

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('requestPerRoute', function () {
    return 'valid';
})->middleware('lpe.requestPerRoute')->name('requestPerRoute');
```

> app\_requests\_latency\_milliseconds\_bucket{route="requestPerRoute",method="GET",status\_code="200",le="0.005"} 0 ... app\_requests\_latency\_milliseconds\_count{route="requestPerRoute",method="GET",status\_code="200"} 1 app\_requests\_latency\_milliseconds\_sum{route="requestPerRoute",method="GET",status\_code="200"} 6 app\_requests\_total{route="requestPerRoute",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

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 52.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/88c2a8e9be2e5a4d6964c31f9e57f282bf7419f70424e215fd51e77032572fe8?d=identicon)[GallopYD](/maintainers/GallopYD)

---

Top Contributors

[![GallopYD](https://avatars.githubusercontent.com/u/26155034?v=4)](https://github.com/GallopYD "GallopYD (19 commits)")[![triadev](https://avatars.githubusercontent.com/u/10552858?v=4)](https://github.com/triadev "triadev (16 commits)")[![martianoff](https://avatars.githubusercontent.com/u/7222812?v=4)](https://github.com/martianoff "martianoff (1 commits)")

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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