PHPackages                             movemoveapp/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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. movemoveapp/laravel-prometheus

ActiveLaravel-package[Logging &amp; Monitoring](/categories/logging)

movemoveapp/laravel-prometheus
==============================

Laravel SDK for working with prometheus metrics

1.2.3(10mo ago)0114MITPHPPHP ^8.1

Since Jul 11Pushed 10mo agoCompare

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

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

Laravel Prometheus Metrics (Fork)
=================================

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

[![Latest Stable Version](https://camo.githubusercontent.com/1ae1b6a59212c1644720ae6a6d8713569186e1f7ab611b77e76283f9979bcb85/687474703a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d70726f6d6574686575732f76)](https://packagist.org/packages/movemoveapp/laravel-prometheus)[![Total Downloads](https://camo.githubusercontent.com/1c6ea6ef7d3c27e7c08ea2042004fcf778538bbca222a03a9d84e87ca5926f03/687474703a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d70726f6d6574686575732f646f776e6c6f616473)](https://packagist.org/packages/movemoveapp/laravel-prometheus)[![Latest Unstable Version](https://camo.githubusercontent.com/38520190725e03429967c37207352a0d681f44844fc523c8d5a4a0f2f689b0b8/687474703a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d70726f6d6574686575732f762f756e737461626c65)](https://packagist.org/packages/movemoveapp/laravel-prometheus)[![License](https://camo.githubusercontent.com/001726252ee70275cd96453eacdb2605a0915d7f2e2c7c7552f955da58d8b19b/687474703a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d70726f6d6574686575732f6c6963656e7365)](https://packagist.org/packages/movemoveapp/laravel-prometheus)[![PHP Version Require](https://camo.githubusercontent.com/8151276c263b543af23e5417b2eccf367cf190bc85e34d16719c6632bbd41086/687474703a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d70726f6d6574686575732f726571756972652f706870)](https://packagist.org/packages/movemoveapp/laravel-prometheus)

> ⚠️ This is a friendly fork of [shureban/laravel-prometheus](https://github.com/shureban/laravel-prometheus),
> created to support `predis/predis ^3.0` until the original maintainer has a chance to fix it 😄

All original functionality is preserved.
The package is designed to collect Prometheus metrics from a Laravel application using a Redis-based storage backend.

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

[](#installation)

Require this package with composer using the following command:

```
composer require movemoveapp/laravel-prometheus
```

Add the following class to the `providers` array in `config/app.php`:

```
Shureban\LaravelPrometheus\PrometheusServiceProvider::class,
```

You can also publish the config file to change implementations (ie. interface to specific class).

```
php artisan vendor:publish --provider="Shureban\LaravelPrometheus\PrometheusServiceProvider"
```

Update `.env` config, change REDIS\_CLIENT from redis to predis:

```
REDIS_CLIENT=predis

```

Creating metric class
---------------------

[](#creating-metric-class)

### CLI supporting

[](#cli-supporting)

You may create metrics via CLI commands

```
# Creating counter metric CustomCounterMetricName
php artisan make:counter CustomCounterMetricName --name={name} --labels={label_1,label_2,label_N} --description={description} --dynamic

# Creating gauge metric CustomGaugeMetricName
php artisan make:gauge CustomGaugeMetricName --name={name} --labels={label_1,label_2,label_N} --description={description} --dynamic
```

OptionAliasRequiredDescriptionnamefalseName of the metriclabelfalseThe metric labels list (comma separated)descriptionfalseThe metric descriptiondynamicdfalseThe metric description### Manual

[](#manual)

Create folder, where you will contain your custom metrics classes (for example `app/Prometheus`). Realise constructor with metric static params.

```
namespace App\Prometheus;

use Shureban\LaravelPrometheus\Counter;
use Shureban\LaravelPrometheus\Attributes\Name;
use Shureban\LaravelPrometheus\Attributes\Labels;

class AuthCounter extends Counter
{
    public function __construct()
    {
        $name   = new Name('auth');
        $labels = new Labels(['event']);
        $help   = 'Counter of auth events';

        parent::__construct($name, $labels, $help);
    }
}
```

Usages
------

[](#usages)

### General metrics flow

[](#general-metrics-flow)

Using DI (or not), increase the metric value.

```
use App\Prometheus\AuthCounter;

class RegisterController extends Controller
{
    public function __invoke(..., AuthCounter $counter): Response
    {
        // Registration new user logic

        $counter->withLabelsValues(['registration'])->inc();
    }
}
```

Or, if you have static list of events, you may realize following flow:

```
namespace App\Prometheus\Counters;

use Shureban\LaravelPrometheus\Counter;
use Shureban\LaravelPrometheus\Attributes\Name;
use Shureban\LaravelPrometheus\Attributes\Labels;

class AuthCounter extends Counter
{
    public function __construct()
    {
        //...
    }

    public function registration(): void
    {
        $this->withLabelsValues(['registration'])->inc();
    }
}
```

This way helps you encapsulate logic with labels, and the code seems pretty

```
use App\Prometheus\AuthCounter;

class RegisterController extends Controller
{
    public function __invoke(..., AuthCounter $counter): Response
    {
        // Registration new user logic

        $counter->registration();
    }
}
```

### Dynamic metrics flow

[](#dynamic-metrics-flow)

Dynamic flow may help you attach more labels with different sizes

```
use App\Prometheus\AuthCounter;
use Shureban\LaravelPrometheus\Attributes\Labels;

class RegisterController extends Controller
{
    public function __invoke(..., DynamicAuthCounter $counter): Response
    {
        // Registration new user logic

        $counter->withLabels(Labels::newFromArray(['event' => 'registration', 'country' => 'US']))->inc();
        $counter->withLabels(Labels::newFromArray(['event' => 'registration', 'country' => 'US', 'browser' => 'chrome']))->inc();
        $counter->withLabels(Labels::newFromCollection($user->only(['country', 'browser'])))->inc();
    }
}
```

Rendering
---------

[](#rendering)

Render metrics data in text format

### Using config

[](#using-config)

In `config/prometheus.php`, find `web_route` param and set preferred route path. Default is `/prometheus/metrics`.

### Manual

[](#manual-1)

For render metrics by route, you need to provide next code:

```
$renderer = new RenderTextFormat();

return response($renderer->render(), Response::HTTP_OK, ['Content-Type' => RenderTextFormat::MIME_TYPE]);
```

of using string type hinting

```
return response(new RenderTextFormat(), Response::HTTP_OK, ['Content-Type' => RenderTextFormat::MIME_TYPE]);
```

---

👋 A note to Shureban
--------------------

[](#-a-note-to-shureban)

Hey bro, just keeping the package warm for you.
When you're ready — feel free to take back control.
Until then, your code is doing great in the wild.

❤️ Pipisco

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance58

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.1% 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 ~0 days

Total

2

Last Release

302d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2510798?v=4)[Dmitriy Kovalev](/maintainers/pipisco)[@pipisco](https://github.com/pipisco)

---

Top Contributors

[![Shureban](https://avatars.githubusercontent.com/u/5560764?v=4)](https://github.com/Shureban "Shureban (41 commits)")[![pipisco](https://avatars.githubusercontent.com/u/2510798?v=4)](https://github.com/pipisco "pipisco (4 commits)")

---

Tags

Metricscountergaugeprometheusgraphanashureban

### Embed Badge

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

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

###  Alternatives

[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[worldia/instrumentation-bundle

Symfony opentelemetry auto-instrumentation: requests, commands, messenger, doctrine.

2769.8k](/packages/worldia-instrumentation-bundle)[triadev/laravel-prometheus-exporter

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

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

Library for handling and displaying custom project metrics

361.9k](/packages/lamoda-metrics)[krenor/prometheus-client

A PHP Client for Prometheus

1020.9k](/packages/krenor-prometheus-client)[mfd/typo3-prometheus

Exports Prometheus metrics for TYPO3 instances

1010.6k](/packages/mfd-typo3-prometheus)

PHPackages © 2026

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