PHP code example of sidcorp-resource / api-metrics-exporter
1. Go to this page and download the library: Download sidcorp-resource/api-metrics-exporter 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/ */
sidcorp-resource / api-metrics-exporter example snippets
use SidcorpResource\ApiMetricsExporter\Contracts\MetricsCollectorInterface;
class CustomController extends Controller
{
public function __construct(private MetricsCollectorInterface $metrics) {}
public function index()
{
$this->metrics->incrementCounter('custom_actions_total');
// Your logic...
}
}
use SidcorpResource\ApiMetricsExporter\Facades\Metrics;
$success = Metrics::flushMetrics();