PHPackages                             zlodes/prometheus-client-laravel - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zlodes/prometheus-client-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zlodes/prometheus-client-laravel
================================

The Prometheus Metrics client adapter for Laravel Framework

2.4.0(1mo ago)333.8k↓19.2%1[2 issues](https://github.com/zlodes/php-prometheus-client-laravel/issues)MITPHPPHP ^8.2CI passing

Since May 7Pushed 1mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (37)Versions (24)Used By (0)

PHP Prometheus Exporter for Laravel
===================================

[](#php-prometheus-exporter-for-laravel)

[![codecov](https://camo.githubusercontent.com/942be898673013b9d93facd8a2553ee37ccd482706cda5d44730d2c03ca9ebce/68747470733a2f2f636f6465636f762e696f2f67682f7a6c6f6465732f7068702d70726f6d6574686575732d636c69656e742d6c61726176656c2f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4a595055573055595435)](https://codecov.io/gh/zlodes/php-prometheus-client-laravel)

This is a Laravel adapter/bridge package for [zlodes/prometheus-client](https://github.com/zlodes/php-prometheus-client).

First steps
-----------

[](#first-steps)

### Installation

[](#installation)

```
composer require zlodes/prometheus-client-laravel
```

### Register a route for the metrics controller

[](#register-a-route-for-the-metrics-controller)

Your application is responsible for metrics route registration. There is a [controller](src/Http/MetricsExporterController.php) ready to use. You can configure groups, middleware or prefixes as you want.

Example:

```
use Illuminate\Support\Facades\Route;
use Zlodes\PrometheusClient\Laravel\Http\MetricsExporterController;

Route::get('/metrics', MetricsExporterController::class);
```

### Configure Storage for metrics \[optional\]

[](#configure-storage-for-metrics-optional)

By default, it uses Redis storage. If you want to use other storage, you can do it easily following these three steps:

1. Create a class implements `Storage` interface.
2. Publish a config: ```
    php artisan vendor:publish --tag=prometheus-client
    ```
3. Set your `storage` class in the config.

Metrics registration
--------------------

[](#metrics-registration)

In your `ServiceProvider::register`:

```
$this->callAfterResolving(Registry::class, static function (Registry $registry): void {
   $registry
       ->registerMetric(
           new Counter('dummy_controller_hits', 'Dummy controller hits count')
       )
       ->registerMetric(
           new Gauge('laravel_queue_size', 'Laravel queue length by Queue')
       );
});
```

Metrics Collector usage
-----------------------

[](#metrics-collector-usage)

You can work with your metrics whenever you want. Just use `Collector`:

```
use Zlodes\PrometheusClient\Collector\CollectorFactory;

class DummyController
{
    public function __invoke(CollectorFactory $collector)
    {
         $collector->counter('dummy_controller_hits')->increment();
    }
}
```

Schedulable collectors
----------------------

[](#schedulable-collectors)

At times, there may be a need to gather metrics on a scheduled basis. The package offers a feature to register a SchedulableCollector that executes every minute using the Laravel Scheduler.

You can define your `SchedulableCollectors` using a [config](config/prometheus-exporter.php) or register it in SchedulableCollectorRegistry directly in a `ServiceProvider`:

```
$this->callAfterResolving(
   SchedulableCollectorRegistry::class,
   static function (SchedulableCollectorRegistry $schedulableCollectorRegistry): void {
       $schedulableCollectorRegistry->push(YourSchedulableCollector::class);
   }
);
```

> **Note**For further details, see [zlodes/prometheus-client](https://github.com/zlodes/php-prometheus-client)

### Available console commands

[](#available-console-commands)

CommandDescription`php artisan metrics:list`Lists all registered metrics`php artisan metrics:clear`Clears metrics storage`metrics:collect-scheduled`Runs `ScheduledCollectors`. Using by SchedulerUpgrade guide
-------------

[](#upgrade-guide)

### From 1.x to 2.x

[](#from-1x-to-2x)

1. Run `php artisan vendor:publish --tag=prometheus-client` to publish a brand-new config
2. Configure the new config based on the previous one (`prometheus-exporter.php`)
3. Drop legacy config (`prometheus-exporter.php`)

Testing
-------

[](#testing)

### Run tests

[](#run-tests)

```
php ./vendor/bin/phpunit
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% 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 ~50 days

Recently: every ~173 days

Total

22

Last Release

56d ago

Major Versions

0.3.0 → 1.0.02023-06-11

1.x-dev → 2.0.02023-10-15

PHP version history (2 changes)0.1.0PHP ^8.1

2.4.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fa5fb01ca9b1e8c18db29e23230211b62f313df293186942b8f009835209956?d=identicon)[zlodes](/maintainers/zlodes)

---

Top Contributors

[![zlodes](https://avatars.githubusercontent.com/u/1114387?v=4)](https://github.com/zlodes "zlodes (41 commits)")[![infureal](https://avatars.githubusercontent.com/u/22548823?v=4)](https://github.com/infureal "infureal (1 commits)")

---

Tags

hacktoberfestlaravellaravel-frameworkprometheus-clientprometheus-exporterprometheus-metrics

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[sylius/promotion

Flexible promotion management for PHP applications.

28477.8k9](/packages/sylius-promotion)

PHPackages © 2026

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