Offers a modern, clean PHP 8.1 API, with support for **default label values**, based on and compatible with the original `promphp/prometheus_client_php` library.
## Installation
```bash
composer require danog/better-prometheus
```
## Usage
```php
<?php
require 'vendor/autoload.php';
use danog\BetterPrometheus\BetterCollectorRegistry;
use Prometheus\Storage\InMemory;
use Prometheus\Storage\Redis;
$adapter = new InMemory;
// Any other promphp adapter may also be used...
// $adapter = new Redis();
$registry = new BetterCollectorRegistry($adapter);
// Note the difference with promphp: the labels are keys => values, not just keys.
$counter = $registry->getOrRegisterCounter(
'test',
'some_counter',
'it increases',
// Note: these are default label key+values, they will be sent verbatim, no changes
['someLabel' => 'defaultValue']
);
// Specify some additional labels post-construction like this (both keys and values)...
$counter->incBy(3, ['type' => 'blue']);
// ...or add some more default labels to the counter, creating a new counter: