PHP code example of vend / phanglia

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

    

vend / phanglia example snippets


// Gets a metric definition
$metric = new Phanglia\Metric('name', Ganglia::TYPE_STRING, Ganglia::SLOPE_UNSPECIFIED);

// The metadata and value packets as binary strings, in case you want to send them yourself
$meta  = $metric->getMetadataPacket();
$value = $metric->getValuePacket('some value')

// Sending them on to a Ganglia collector (default udp://127.0.0.1:8649)
$socket = new Phanglia\Socket();
$socket->sendMetric($metric, 'some value');