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

ActiveLibrary

vmorozov/laravel-prometheus
===========================

Prometheus client for laravel framework. Includes some of default metrics for any laravel application out of the box and ability to add custom metrics easily. .

v1.3.2(3mo ago)0638—0%[2 PRs](https://github.com/freezer278/laravel-prometheus/pulls)MITPHPPHP ^8.1CI passing

Since May 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/freezer278/laravel-prometheus)[ Packagist](https://packagist.org/packages/vmorozov/laravel-prometheus)[ Docs](https://github.com/vmorozov/laravel-prometheus)[ GitHub Sponsors](https://github.com/vmorozov)[ RSS](/packages/vmorozov-laravel-prometheus/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (6)Versions (18)Used By (0)

Prometheus client for laravel framework
=======================================

[](#prometheus-client-for-laravel-framework)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3250ee369a566097c973680aa12f7e4b1ea780a4f3efb6d784b4be02385bb5bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766d6f726f7a6f762f6c61726176656c2d70726f6d6574686575732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vmorozov/laravel-prometheus)[![Tests](https://camo.githubusercontent.com/7b35daa8b491a2f799990b2727f5b5af3a01fdcad102865dc3ed8e9301e6865a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f667265657a65723237382f6c61726176656c2d70726f6d6574686575732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/freezer278/laravel-prometheus/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/3e72f17749c55179aa54c213566b9c3522fe23af8ca6d45b353e8aa3ba987f53/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766d6f726f7a6f762f6c61726176656c2d70726f6d6574686575732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vmorozov/laravel-prometheus)

A Laravel package for integrating Prometheus metrics collection into your Laravel application.
This package makes it easy to collect and expose metrics for monitoring your application's performance and behavior.

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

[](#installation)

1. Install the package via composer:

```
composer require vmorozov/laravel-prometheus
```

2. Publish vendor files:

```
php artisan vendor:publish --provider="VMorozov\\Prometheus\\PrometheusServiceProvider"
```

Upgrading version
-----------------

[](#upgrading-version)

1. Update the package version in `composer.json`
2. Run

```
composer update
```

3. Run command to update configs:

```
php artisan vendor:publish --provider="VMorozov\\Prometheus\\PrometheusServiceProvider" --force
```

4. Run clear stored metrics:

```
php artisan prometheus:clear_stored_metrics
```

Usage
-----

[](#usage)

This package provides default metrics that allow you to monitor response times (divided into buckets and percentiles) and request counts.
It also allows you to create custom metrics and collectors for your specific needs.

To see the collected metrics, go to the `/metrics` endpoint of your application.
This endpoint returns metrics in the Prometheus exposition format, which can be scraped by a Prometheus server.

You can clear stored metrics using the built-in `prometheus:clear_stored_metrics` command:

```
php artisan prometheus:clear_stored_metrics
```

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

[](#configuration)

The package can be configured using the `laravel-prometheus.php` configuration file.
This file is published to your application's `config` directory when you run the `vendor:publish` command.

Key configuration options include:

- **namespace**: Prefix for all metrics (default: your APP\_NAME env value)
- **storage\_type**: How metrics data is stored (**redis**, in\_memory, apcu)
- **route\_url**: URL path for the metrics endpoint (default: `/metrics`)
- **default\_metrics\_enabled**: Whether default metrics are enabled (they are enabled by default)
- **on\_demand\_metric\_collectors**: Collectors that run only when the metrics endpoint is accessed

For detailed configuration information, see the [Configuration Documentation](docs/configuration.md).

Default Metrics
---------------

[](#default-metrics)

The package includes two default metrics:

1. **Request Duration Histogram**: Measures the duration of HTTP requests.
2. **Queue Size Gauge**: Measures the size of Laravel queues (you have to configure which connections and queues to monitor).

For more information about the default metrics, see the [Default Metrics Documentation](docs/default-metrics.md).

Custom Metrics
--------------

[](#custom-metrics)

You can create custom metrics to monitor specific aspects of your application. The package supports three types of metrics:

1. **Counter**: A cumulative metric that only increases (requests\_processed, users\_registered, etc.)
2. **Gauge**: A metric that can go up and down and represents current state of something (example: queue\_size, cpu\_load, etc.)
3. **Histogram**: A metric that samples observations and counts them in buckets (when you need to have quantiles of your metric values)

For information on creating and using custom metrics, see the [Custom Metrics Documentation](docs/custom-metrics.md).

On-Demand Metrics Collectors
----------------------------

[](#on-demand-metrics-collectors)

On-Demand Metrics Collectors are classes that collect metrics only when the metrics endpoint is accessed.
This is useful for metrics that are expensive to collect or that don't need to be updated on every request.

For information on creating and using custom On-Demand Metrics Collectors, see the [On-Demand Metrics Collectors Documentation](docs/on-demand-metrics-collectors.md).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Vladimir Morozov](https://github.com/vmorozov)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance78

Regular maintenance activity

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.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 ~12 days

Total

15

Last Release

116d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1487aab1174b98688909d82fa4014f59f66c80242d61fef733ae1045ab17f4d?d=identicon)[vmorozov](/maintainers/vmorozov)

---

Top Contributors

[![freezer278](https://avatars.githubusercontent.com/u/17979033?v=4)](https://github.com/freezer278 "freezer278 (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

laravel-prometheusvmorozov

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2531.2M4](/packages/spatie-laravel-prometheus)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

136.9k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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