A PHP Client for Prometheus

0.4.1 2019-12-15 16:48 UTC

This package is auto-updated.

Last update: 2022-06-29 01:42:16 UTC


Monitor your PHP applications using Prometheus.

icon-version icon-php icon-build
icon-code-quality icon-code-coverage icon-license


  • Support for Counters, Gauges, Histograms, Summaries and custom metrics
  • Various storage repositories
  • Easy usage in style of Laravels Eloquent ORM
  • Initialization of Metrics without labels
  • Support of float values
  • Push Gateway
  • State exporters (for fpm_get_status() or opcache_get_status())

Planned features

  • PHP 7.4 rewrite
  • Laravel integration

Project State

This library is currently under development.

As long as it's not tagged in a >= 1.* version I could commit incompatible changes!



use Krenor\Prometheus\Metrics\Metric;
use Krenor\Prometheus\Metrics\Counter;
use Krenor\Prometheus\CollectorRegistry;
use Krenor\Prometheus\Renderer\TextRenderer;
use Krenor\Prometheus\Storage\StorageManager;
use Krenor\Prometheus\Storage\Repositories\InMemoryRepository;
use Krenor\Prometheus\Tests\Stubs\MultipleLabelsCounterStub as ExampleCounter;

Metric::storeUsing(new StorageManager(new InMemoryRepository));

$registry = new CollectorRegistry;

$counter = $registry->register(new ExampleCounter);

$counter->increment(['some', 'label', 'values']);
$counter->incrementBy(3, ['foo', 'bar', 'baz']);

$samples = $registry->collect();
$metrics = (new TextRenderer)->render($samples);

A more detailed documentation can be found here.

Note: Since this project is in the works, some parts may lack documentation.
You can orient yourself on the tests if something's unclear.


Please see CONTRIBUTING for more information.


The MIT License. Please see LICENSE for more information.