1. Go to this page and download the library: Download philiplb/phpprom library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
philiplb / phpprom example snippets
$storage = new PHPProm\Storage\Redis('localhost', 'supersecret');
$silexPrometheusSetup = new PHPProm\Integration\SilexSetup();
$metricsAction = $silexPrometheusSetup->setupAndGetMetricsRoute($app, $storage);
$app->get('/metrics', $metricsAction);
$storage->addAvailableMetric(
$metric, // the Prometheus metric name itself
$label, // the name of the one Prometheus label to categorize the values
$help, // a small, meaningful help text for the metric
$type, // the Prometheus type of the metric like "gauge" or "counter"
$defaultValue // the default value to be taken if no measurement happened yet for the metric/label combination, "Nan" for example or "0"
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.