PHP code example of dosomething / stathat

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

    

dosomething / stathat example snippets


  use DoSomething\StatHat\Client as StatHat;
  
  $stathat = new StatHat([
    'user_key' => '<your_user_key>',       //       //      // optional! will prevent sending stats if true.
  ]);
  
  // And go!
  $stathat->ezCount('<stat_name>', 1);
  $stathat->ezValue('<stat_name>', 15);
  
  $stathat->count('<stat_key>', 1);
  $stathat->value('<stat_key>', 9);

  'providers' => [
    // ...
    DoSomething\StatHat\StatHatServiceProvider::class,
  ],
  
  'aliases' => [
    // ...
    'StatHat' => DoSomething\StatHat\Facades\StatHat::class
  ],

  'stathat' => [
    'user_key' => '<your_user_key>',       // ount() and ezValue()
    'prefix' => 'appname - ',              // optional! will be prepended to EZ stat names
    'debug' => env('APP_DEBUG'),           // optional! will prevent sending stats in debug mode.
  ],

  StatHat::ezCount('<stat_name>', 1);
  StatHat::ezValue('<stat_name>', 15);
  
  StatHat::count('stat_key', 1);
  StatHat::value('stat_key', 9);