<commit_before># StatHat [![Packagist](https://img.shields.io/packagist/v/dosomething/stathat.svg)](https://packagist.org/packages/dosomething/stathat)
This is a simple, modern API wrapper for [StatHat](https://www.stathat.com). It also includes
optional support for usage as a service provider & facade in Laravel 4 or 5.

### Installation
Install with Composer:
```json
"require": {
    "dosomething/stathat": "~1.0.0"
}
```

### Usage
In vanilla PHP, simply require the `Client` class and create a new instance with your credentials.
```php
  use DoSomething\StatHat\Client as StatHat;
  
  $stathat = new StatHat([
    'enabled' => (getenv('APP_ENV') == 'production'),
    'ez_key' => '...',
    'user_key' => '...'
  ]);
  $stathat->ezCount('stat_name', 1);
```

### Laravel Usage
Laravel support is built-in. Simply add a service provider & facade alias to your `config/app.php`:

```php
  'providers' => [
    // ...
    'DoSomething\StatHat\StatHatServiceProvider'
  ],
  
  'aliases' => [
    // ...
    'StatHat' => 'DoSomething\StatHat\Facade'
  ]
```

Finally, add your keys to the `config/services.php` configuration array:

```php
  'stathat' => [
    'ez_key' => 'your_ez_key@<EMAIL>' // required for EZ API
    'user_key' => '<Your_User_Key>' // required for Classic API
  ]
```

The `StatHat` facade will now be accessible from anywhere in your application:
```php<commit_msg>Update notes for optional debug parameter<commit_after># StatHat [![Packagist](https://img.shields.io/packagist/v/dosomething/stathat.svg)](https://packagist.org/packages/dosomething/stathat)
This is a simple, modern API wrapper for [StatHat](https://www.stathat.com). It also includes
optional support for usage as a service provider & facade in Laravel 4 or 5.

### Installation
Install with Composer:
```json
"require": {
    "dosomething/stathat": "~1.0.0"
}
```

### Usage
In vanilla PHP, simply require the `Client` class and create a new instance with your credentials.
```php
  use DoSomething\StatHat\Client as StatHat;
  
  $stathat = new StatHat([
    'ez_key' => '...',
    'user_key' => '...',
    'debug' => (getenv('APP_ENV') != 'production')
  ]);
  $stathat->ezCount('stat_name', 1);
```

### Laravel Usage
Laravel support is built-in. Simply add a service provider & facade alias to your `config/app.php`:

```php
  'providers' => [
    // ...
    'DoSomething\StatHat\StatHatServiceProvider'
  ],
  
  'aliases' => [
    // ...
    'StatHat' => 'DoSomething\StatHat\Facade'
  ]
```

Finally, add your keys to the `config/services.php` configuration array:

```php
  'stathat' => [
    'ez_key' => 'your_ez_<EMAIL>' // required for EZ API
    'user_key' => '<Your_User_Key>' // required for Classic API
  ]
```

The `StatHat` facade will now be accessible from anywhere in your application:
```php
{'fraction_non_alphanumeric': 0.16346153846153846, 'fraction_numerical': 0.004273504273504274, 'mean_word_length': 3.728956228956229, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6551231', 'n_tokens_mistral': 1009, 'n_tokens_neox': 955, 'n_words': 258}