PHP code example of squinones / woof

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

    

squinones / woof example snippets


// Create a new client (localhost:8125 is the default)
$woof = new Woof("localhost", 8125);

$woof->gauge("gas_tank.level", 0.75);
$woof->gauge("users.active", 1001);

$woof->increment("database.query.count");
$woof->increment("page_view.count", 10);
$woof->decrement("available.threads");

$woof->histogram("database.query.time", 0.5);
$woof->histogram("file.upload.size", filesize($file));

$woof->set("users.uniques", $user->getId());

$woof->timer("response.time", 200);

$woof->increment("api.requests", 1, ["api"]);               // adds #api tag
$woof->increment("api.errors", 1, ["error_code" => 400]);   // adds #error_code:400 tag

$woof->histogram("my.histogram", 1, [], 0.5);