PHPackages                             gupalo/prometheus-helper - 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. gupalo/prometheus-helper

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

gupalo/prometheus-helper
========================

Prometheus Helper

2.1(5mo ago)014.8k↓18.8%1MITPHPPHP &gt;=8.3

Since Feb 16Pushed 5mo ago2 watchersCompare

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

READMEChangelogDependencies (4)Versions (21)Used By (0)

Prometheus Helper
=================

[](#prometheus-helper)

Wrapper for PHP Prometheus library - [https://github.com/PromPHP/prometheus\_client\_php](https://github.com/PromPHP/prometheus_client_php)

Install
-------

[](#install)

```
composer require gupalo/prometheus-helper

```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Gupalo\PrometheusHelper\FileAdapter;
use Gupalo\PrometheusHelper\Prometheus;

$helper = new Prometheus(new FileAdapter('/var/prom'), 'myapp');

// Counter
$helper->inc('requests_total', 'Total requests');
$helper->inc('requests_total', 'Total requests', ['method' => 'GET']);

// Gauge
$helper->gaugeSet(100, 'temperature', 'Current temperature');
$helper->gaugeInc('active_connections', 'Active connections');
$helper->gaugeDec('active_connections', 'Active connections');

// Histogram
$helper->observe(0.5, 'request_duration_seconds', 'Request duration');

// Render metrics
$response = $helper->render();
```

### With Redis Storage (DSN)

[](#with-redis-storage-dsn)

```
use Gupalo\PrometheusHelper\Prometheus;
use Gupalo\PrometheusHelper\RedisAdapter;

$helper = new Prometheus(new RedisAdapter('redis://redis'), 'myapp');
$helper->inc('requests_total', 'Total requests');
```

Supported DSN formats:

- `redis://redis` - simple hostname
- `redis://redis:6380` - with port
- `redis://:password@redis:6379` - with password
- `redis://user:password@redis:6379/2` - with user, password and database
- `redis://redis:6379/0?timeout=0.5&persistent=true` - with options

### Symfony Integration

[](#symfony-integration)

Configure in `config/services.yaml`:

```
services:
    Prometheus\Storage\Adapter:
        class: Gupalo\PrometheusHelper\RedisAdapter
        arguments:
            $dsn: '%env(REDIS_DSN)%'
    Gupalo\PrometheusHelper\Prometheus:
        arguments:
            $adapter: '@Prometheus\Storage\Adapter'
            $namespace: 'myapp'

when@dev:
    services:
        Prometheus\Storage\Adapter:
            class: Gupalo\PrometheusHelper\FileAdapter
            arguments:
                $dir: '%kernel.project_dir%/var/prom'

when@test:
    services:
        Prometheus\Storage\Adapter:
            class: Prometheus\Storage\InMemory
```

Then inject in your services:

```
class MyService
{
    public function __construct(
        private readonly Prometheus $prometheus,
    ) {}

    public function doSomething(): void
    {
        $this->prometheus->inc('operations_total', 'Total operations');
    }
}
```

Also see `tests` for more examples.

### Migration from v1 to v2

[](#migration-from-v1-to-v2)

Ask Claude:

```
find all PrometheusHelper usages and change to Prometheus
read doc from: vendor/gupalo/prometheus-helper/README.md

```

Or do it manually:

- update `config/services.yaml` - add code from "Symfony Integration" section above
- change all `use Gupalo\PrometheusHelper\PrometheusHelper;` to `use Gupalo\PrometheusHelper\Prometheus;`
- add to constructor `private readonly Prometheus $prometheus,`
- change all `PrometheusHelper::` to `$this->prometheus->`

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance70

Regular maintenance activity

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 84.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 ~77 days

Recently: every ~98 days

Total

19

Last Release

167d ago

Major Versions

1.11 → 2.02025-12-02

PHP version history (4 changes)1.0.0PHP &gt;=8.1

1.1.0PHP &gt;=8.0

1.4.0PHP &gt;=7.1

1.5.0PHP &gt;=8.3

### Community

Maintainers

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

---

Top Contributors

[![luchaninov](https://avatars.githubusercontent.com/u/3829796?v=4)](https://github.com/luchaninov "luchaninov (22 commits)")[![Okspen](https://avatars.githubusercontent.com/u/388928?v=4)](https://github.com/Okspen "Okspen (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gupalo-prometheus-helper/health.svg)

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

###  Alternatives

[spatie/flare-client-php

Send PHP errors to Flare

176148.0M15](/packages/spatie-flare-client-php)[lkaemmerling/laravel-horizon-prometheus-exporter

A small package to gain and export long time information from Laravel &amp; Horizon for Prometheus.

1602.0M](/packages/lkaemmerling-laravel-horizon-prometheus-exporter)[nelmio/js-logger-bundle

Adds logging of JS errors in your Symfony application

1761.2M](/packages/nelmio-js-logger-bundle)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[bugsnag/bugsnag-symfony

Official BugSnag notifier for Symfony applications.

453.0M3](/packages/bugsnag-bugsnag-symfony)

PHPackages © 2026

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