PHPackages                             click/laravel-prometheus-metrics - 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. click/laravel-prometheus-metrics

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

click/laravel-prometheus-metrics
================================

Framework-agnostic Laravel middleware for Prometheus metrics collection

1.0.1(1y ago)3580↓92.9%1PHPPHP ^8.3

Since Apr 30Pushed 1y agoCompare

[ Source](https://github.com/click-llc/laravel-prometheus-metrics-starter)[ Packagist](https://packagist.org/packages/click/laravel-prometheus-metrics)[ RSS](/packages/click-laravel-prometheus-metrics/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel Prometheus Metrics Starter
==================================

[](#laravel-prometheus-metrics-starter)

A simple and extensible Laravel package for collecting and exposing metrics in the [Prometheus](https://prometheus.io/) format. Ideal as a starting point for building custom monitoring solutions.

🚀 Features
----------

[](#-features)

- Ready-to-use `/metrics` endpoint for Prometheus scraping
- Flexible and centralized configuration
- Extensible architecture with support for custom collectors
- Histogram buckets for operation duration tracking
- Cache support to reduce overhead

📦 Installation
--------------

[](#-installation)

```
composer require click/laravel-prometheus-metrics
```

⚙️ Publishing Configuration
---------------------------

[](#️-publishing-configuration)

Publish the configuration file using Artisan:

```
php artisan vendor:publish --tag=prometheus-config
```

OptionDescriptionDefault`route_path`The path to expose metrics`/metrics``cache_ttl`Cache duration in seconds (uses Laravel Cache)`3600` (1 hour)`prefix`Metric name prefix (can be set via `PREFIX_PROMETHEUS_METRICS` env var)`''``buckets`Histogram buckets for measuring durations`[0.01, 0.05, 0.1, 0.3, 0.5, 1]`🌐 Routes
--------

[](#-routes)

After installation, the following route becomes available automatically:

```
GET /metrics
```

This route exposes metrics in Prometheus text exposition format.

🧩 Middleware Integration
------------------------

[](#-middleware-integration)

You can attach Prometheus metric collection to specific routes via middleware.

### Option 1: Using an alias

[](#option-1-using-an-alias)

Register the alias in your `config/app.php`:

```
'aliases' => [
    'prometheus' => \YourVendor\Prometheus\Middleware\PrometheusMiddleware::class,
    // ...
],
```

Then apply the middleware by alias:

```
use Illuminate\Support\Facades\Route;

Route::get('/health', fn() => ['ok' => true])
    ->middleware('prometheus');
```

### Option 2: Using the class directly

[](#option-2-using-the-class-directly)

```
use YourVendor\Prometheus\Middleware\PrometheusMiddleware;

Route::get('/health', fn() => ['ok' => true])
->middleware([PrometheusMiddleware::class]);
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance45

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~6 days

Total

2

Last Release

424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/956d767c2785cf89e2b85e42d0f08eadc7fa0664d0d26625c4aabebabaa55e93?d=identicon)[clickuzglobal](/maintainers/clickuzglobal)

---

Top Contributors

[![artyomkuzminski](https://avatars.githubusercontent.com/u/85961879?v=4)](https://github.com/artyomkuzminski "artyomkuzminski (2 commits)")[![TimofeySemenenko](https://avatars.githubusercontent.com/u/11330519?v=4)](https://github.com/TimofeySemenenko "TimofeySemenenko (1 commits)")

---

Tags

laravellaravel-frameworklaravel-packagelaravel-prometheusphpprometheusprometheus-laravelprometheus-php

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/click-laravel-prometheus-metrics/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.6k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M278](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M344](/packages/open-telemetry-sdk)

PHPackages © 2026

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