1. Go to this page and download the library: Download flagbit/metrics-bundle 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/ */
flagbit / metrics-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Flagbit\Bundle\MetricsBundle\FlagbitMetricsBundle(),
// ...
);
}
}
namespace Flagbit\ExampleBundle\MetricProvider;
use Flagbit\Bundle\MetricsBundle\Collector\CollectorInterface;
use Flagbit\Bundle\MetricsBundle\Provider\ProviderInterface;
class Provider implements ProviderInterface
{
public function collectMetrics(CollectorInterface $collector)
{
$value = random_int(1,9);
$collector->measure('foo.bar', $value);
}
}
// Collects the metrics of all your tagged services...
$container->get('flagbit_metrics.provider_invoker')->collectMetrics();
// ... and flush them
$container->get('flagbit_metrics.provider_invoker')->onTerminate();
bash
$ php bin/console flagbit:metrics:flush
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.