轻松创建应用程序的指标。(Easily create metrics for your application.)
https://github.com/sakanjo/laravel-easy-metrics
支持的指标
BarmetricDoughnutmetricLinemetricPiemetricPolarmetricTrendmetricValuemetric
安装
1 | composer require sakanjo/laravel-easy-metrics |
使用
Value metric
1 | use SaKanjo\EasyMetrics\Metrics\Value; |
Query types
The currently supported aggregate functions to calculate a given column compared to the previous time interval / range
Min
1 | Value::make(User::class) |
Max
1 | Value::make(User::class) |
Sum
1 | Value::make(User::class) |
Average
1 | Value::make(User::class) |
Count
1 | Value::make(User::class) |
Doughnut metric
1 | use SaKanjo\EasyMetrics\Metrics\Doughnut; |
It’s always better to use the
optionsmethod even though it’s optional, since the retrieved data may not include all enum options.
Query types
The currently supported aggregate functions to calculate a given column compared to the previous time interval / range
Min
1 | Doughnut::make(User::class) |
Max
1 | Doughnut::make(User::class) |
Sum
1 | Doughnut::make(User::class) |
Average
1 | Doughnut::make(User::class) |
Count
1 | Doughnut::make(User::class) |
Trend metric
1 | use SaKanjo\EasyMetrics\Metrics\Trend; |
Query types
The currently supported aggregate functions to calculate a given column compared to the previous time interval / range
Min
1 | $trend->minByYears('age'); |
Max
1 | $trend->maxByYears('age'); |
Sum
1 | $trend->sumByYears('age'); |
Average
1 | $trend->averageByYears('age'); |
Count
1 | $trend->countByYears(); |
Other metrics
Bar extends TrendLine extends TrendDoughnut extends PiePolar extends Pie
Ranges
Every metric class contains a ranges method, that will determine the range of the results based on it’s date column.
1 | use SaKanjo\EasyMetrics\Metrics\Trend; |
Available custom ranges
Range::TODAYRange::YESTERDAYRange::MTDRange::QTDRange::YTDRange::ALL
🔥 Practical examples
Filamentphp v3 widgets
1 |
|