Laravel 4 integration for the Stathat API
php >= 5.4
Begin by installing this package through Composer. Edit your project's composer.json file to require diegorivas89/stathat-laravel.
Next, update Composer from the Terminal:
Once this operation completes, add the service provider. Open app/config/app.php, and add a new item to the providers array.
Also you can add the facade accesor to the end of aliases key in app/config/app.php
'Stathat' => 'Stathat\Facades\StathatEz'
or if you want to use the classic api
'Stathat' => 'Stathat\Facades\StathatClassic'
The final step is publish the config file. For this, run
php artisan config:publish
In the published file you must set your credentials, this is the user_key and the email depending on the type of api you will use.
Stathat::count('page_views'); // default value is 1
or if you have to have to use more than one account of stathat, you could do:
Stathat::count('page_views', 1); // default account from config
Stathat::count('page_views', 1, 'email@example.com');
Stathat::count('page_views', 1, 'firstname.lastname@example.org');