2017 © Pedro Peláez
 

library stathat

Simple API wrapper for StatHat.

image

dosomething/stathat

Simple API wrapper for StatHat.

  • Tuesday, May 10, 2016
  • by DFurnes
  • Repository
  • 9 Watchers
  • 3 Stars
  • 3,296 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

StatHat StyleCI Packagist

This is a simple, modern API wrapper for StatHat. It also includes optional support for usage as a service in Laravel 5., (*1)

Installation

Install with Composer:, (*2)

"require": {
    "dosomething/stathat": "^2.0.0"
}

Usage

In vanilla PHP, require the Client class and create a new instance with your credentials., (*3)

  use DoSomething\StatHat\Client as StatHat;

  $stathat = new StatHat([
    'user_key' => '<your_user_key>',       // required for count() and value()
    'ez_key' => 'your_ez_key@example.com', // required for ezCount() and ezValue()
    'access_token' => 'ABC123abc',         // required for AlertsAPI
    'prefix' => 'appname - ',              // optional! will be prepended to EZ stat names
    'debug' => false,                      // 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);

Laravel Usage

Laravel support is built-in. Simply add a service provider & facade alias to your config/app.php:, (*4)

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

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

Finally, add your keys to the config/services.php configuration array:, (*5)

  'stathat' => [
    'user_key' => '<your_user_key>',       // required for count() and value()
    'ez_key' => 'your_ez_key@example.com', // required for ezCount() and ezValue()
    'prefix' => 'appname - ',              // optional! will be prepended to EZ stat names
    'debug' => env('APP_DEBUG'),           // optional! will prevent sending stats in debug mode.
  ],

The StatHat facade will now be accessible from anywhere in your application:, (*6)

  StatHat::ezCount('<stat_name>', 1);
  StatHat::ezValue('<stat_name>', 15);

  StatHat::count('stat_key', 1);
  StatHat::value('stat_key', 9);

License

©2016 DoSomething.org. StatHat-PHP is free software, and may be redistributed under the terms specified in the LICENSE file. The name and logo for DoSomething.org are trademarks of Do Something, Inc and may not be used without permission., (*7)

The Versions

10/05 2016

dev-master

9999999-dev

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by David Furnes

10/05 2016

dev-Issue10-Alerts_list

dev-Issue10-Alerts_list

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by David Furnes

07/03 2016

v2.0.1

2.0.1.0

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by David Furnes

07/03 2016

v2.0.0

2.0.0.0

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by David Furnes

28/05 2015

v1.1.0

1.1.0.0

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

 

by David Furnes

05/05 2015

v1.0.0

1.0.0.0

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

 

by David Furnes

01/05 2015

v0.0.1

0.0.1.0

Simple API wrapper for StatHat.

  Sources   Download

MIT

The Requires

 

by David Furnes