PHPackages                             laravel-ready/statistics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravel-ready/statistics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laravel-ready/statistics
========================

Ready to use Laravel statistic package

v1.1.8(2y ago)246[1 issues](https://github.com/laravel-ready/laravel-statistics/issues)MITPHPPHP ^8.1 || ^8.0

Since Mar 31Pushed 2y ago1 watchersCompare

[ Source](https://github.com/laravel-ready/laravel-statistics)[ Packagist](https://packagist.org/packages/laravel-ready/statistics)[ RSS](/packages/laravel-ready-statistics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (13)Versions (12)Used By (0)

Statistics
==========

[](#statistics)

[![Statistics](https://camo.githubusercontent.com/dbdf90cdd9f2f90ef1b4335b5d559a10bfb255054f6c4bedc8387a97329f3fc4/68747470733a2f2f707265766965772e647261676f6e2d636f64652e70726f2f4c61726176656c52656164792f737461746973746963732e7376673f6272616e643d6c61726176656c)](https://github.com/laravel-ready/statistics)

[![Stable Version](https://camo.githubusercontent.com/b39bafe249a60c5a90c9320c9a725165358c10231ce290798b2025e0b06af52e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c61726176656c2d72656164792f737461746973746963733f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-ready/statistics)[![Unstable Version](https://camo.githubusercontent.com/85afbac0745eb275d863cee4b1701a70c0e30315d27990b00f1abd553b8761e8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f756e737461626c652d6465762d2d6d61696e2d6f72616e67653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-ready/statistics)[![Total Downloads](https://camo.githubusercontent.com/a20ab8d3f528b75c9ed30e6a7d4ab7d0e8e8b05b295ec2f80ade2a55ee999f3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d72656164792f737461746973746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-ready/statistics)[![License](https://camo.githubusercontent.com/75e07894784382e15bfd8ff58a3f077ffe3ecad333d9a47c582c60b1d854d89b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726176656c2d72656164792f737461746973746963732e7376673f7374796c653d666c61742d737175617265)](LICENSE)

📂 About
-------

[](#-about)

Ready to use Laravel statistic package...

📦 Installation
--------------

[](#-installation)

Get via composer

```
composer require laravel-ready/statistics
```

⚙️ Configs
----------

[](#️-configs)

```
php artisan vendor:publish --tag=statistics-config
```

Migrations
----------

[](#migrations)

```
# publish migrations
php artisan vendor:publish --tag=statistics-migrations

# apply migrations
php artisan migrate --path=/database/migrations/laravel-ready/statistics
```

📝 Usage
-------

[](#-usage)

Add `Statisticable` trait to your model

```
use LaravelReady\Statistics\Traits\Statisticable;

class Post extends Model
{
    use Statisticable;
}
```

Then call `touch` or `hit` method to run statistic mechanism

```
use LaravelReady\Statistics\Supports\Statistic;

Statistic::touch($model); // process data then save it
Statistic::hit($model); // just saves raw data without processing (then you can process it later with jobs)
```

Access statistic data

```
$stats = $model->load('statistics');
```

Process statistic data with scheduled command (or you can use `LaravelReady\Statistics\Jobs\ProcessStatistic` job)

```
