PHP code example of nti / metrics-bundle

1. Go to this page and download the library: Download nti/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/ */

    

nti / metrics-bundle example snippets


    public function registerBundles()
    {
        $bundles = array(
            ...
            new NTI\MetricsBundle\NTIMetricsBundle(),
            ...
        );
    }

3. Setup the configuration in the ``config.yml``


$collector = $container->get('nti.metrics');

$collector->increment('glbs.email.send');            # Same as send "glbs.email.send:1|c"
$collector->decrement('glbs.email.send');            # Same as send "glbs.email.send:-1|c"

$collector->flush();