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

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

cloudisle/laravel-prometheus
============================

A Laravel package for Prometheus integration.

0.1.0(11mo ago)05MITPHPPHP &gt;=8.0CI passing

Since May 30Pushed 11mo agoCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

laravel-prometheus
==================

[](#laravel-prometheus)

A Laravel package for integrating [Prometheus](https://prometheus.io/) metrics into your Laravel application. This package provides a simple API for defining, registering, and exposing custom metrics, as well as a `/metrics` endpoint for Prometheus scraping.

Features
--------

[](#features)

- Register and expose counters, gauges, histograms, and summaries
- Simple API via Metrics and Prometheus facades
- Configurable default labels and metric definitions
- Built-in `/metrics` endpoint
- Optional basic authentication for metrics endpoint

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

[](#installation)

1. Install via Composer:

    ```
    composer require cloudisle/laravel-prometheus
    ```
2. (Optional) Publish the config files:

    ```
    php artisan vendor:publish --provider="CloudIsle\Prometheus\PrometheusServiceProvider" --tag=config
    ```

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

[](#configuration)

The package provides two config files:

- `config/prometheus.php`: Prometheus storage and endpoint settings
- `config/metrics.php`: Default labels and metric definitions

### prometheus.php

[](#prometheusphp)

- `driver`: Storage driver for metrics (`memory`, `redis`, or `apcu`)
- `auth.enabled`: Enable basic auth for `/metrics` endpoint
- `auth.username` / `auth.password`: Credentials for basic auth

### metrics.php

[](#metricsphp)

- `namespace`: Default namespace for metrics
- `labels`: Default labels applied to all metrics (as an associative array)
- `counters`, `gauges`, `histograms`, `summaries`: Predefined metrics to register at boot. Each metric's `labels` should be an array of label names (not key-value pairs).

Example:

```
return [
    'namespace' => 'myapp',
    'labels' => [
        'app' => 'myapp',
        'env' => env('APP_ENV'),
    ],
    'counters' => [
        [
            'name' => 'requests_total',
            'help' => 'Total HTTP requests',
            'labels' => ['route'], // array of label names
        ],
    ],
    // ...
];
```

Usage
-----

[](#usage)

### Facades

[](#facades)

#### Metrics

[](#metrics)

The `Metrics` facade provides a simple API for interacting with your metrics. When recording or incrementing metrics, you must provide label values in the same order as defined in the metric's `labels` array in the config. Default labels from the config are always prepended in order.

```
use Metrics;

// Increment a counter (label values: [default labels..., route])
Metrics::increment('requests_total', ['path' => '/', 'route' => 'home']);

// Set a gauge
Metrics::record('memory_usage', 123.45, ['proc' => 'worker-1']);

// Observe a histogram
Metrics::observe('response_time', 0.234, ['resource' => 'api']);

// Summarize a value
Metrics::summarize('payload_size', 512, ['action' => 'upload']);
```

- If you provide a label value for a label defined in the config's `labels`, it will override the default value for that label.
- The order of label values must match the order of label names as defined in the metric's `labels` array, after the default labels.

#### Prometheus

[](#prometheus)

The `Prometheus` facade gives you direct access to the underlying Prometheus client:

```
use Prometheus;

// Get a counter instance
$counter = Prometheus::counter('my_ns', 'my_counter', 'Help text', ['foo', 'bar']);
$counter->incBy(1, ['val1', 'val2']);
```

### Metrics Endpoint

[](#metrics-endpoint)

The `/metrics` route is automatically registered and returns all metrics in Prometheus text format. You can secure it with basic auth by enabling it in `prometheus.php` config.

Error Handling
--------------

[](#error-handling)

You can customize how metric registration errors are handled by binding your own implementation of `CloudIsle\Prometheus\MetricErrorHandler` in the service container.

Testing
-------

[](#testing)

This package is fully testable with [Orchestra Testbench](https://github.com/orchestral/testbench). See the `tests/` directory for examples.

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance50

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

353d ago

### Community

Maintainers

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

---

Top Contributors

[![bbrist](https://avatars.githubusercontent.com/u/67707859?v=4)](https://github.com/bbrist "bbrist (6 commits)")

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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