Simple statistics package for Laravel inspired by Simplestats for Kohana.
- PHP 7.1+
- Laravel 5.5+
Install the package via composer:
composer require czemu/laravel-simplestats
If you're using Laravel >= 5.5, the package will register itself automatically.
Publish the migrations:
php artisan vendor:publish --provider='Czemu\Simplestats\SimplestatsServiceProvider' --tag="migrations"
Run the migrations:
php artisan migrate
You can also publish the config file:
php artisan vendor:publish --provider='Czemu\Simplestats\SimplestatsServiceProvider' --tag="config"
Update or create statistics for an item named "file" with id "1":
Simplestats::update('file', 1);
Update or create unique statistics (based on cookie) for an item named "print" with id "2":
Simplestats::update('print', 2, TRUE);
Get statistics for an item named "page" with id "3":
Simplestats::get('page', 3);
Get statistics for an item named "download" with id "4" on specified date:
Simplestats::get('download', 4, '2018-05-20');
Get statistics for an item named "click" with id "5" between specified date range:
Simplestats::get('download', 5, ['2018-05-01', '2018-05-15']);
The MIT License (MIT). Please see the LICENSE.md file for more information.