1. Go to this page and download the library: Download eliseekn/laravel-metrics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eliseekn / laravel-metrics example snippets
// generate trends of products amount's sum for the current year
LaravelMetrics::query(Product::query())
->count()
->byMonth()
->trends();
// generate trends of orders amount's sum for the last 6 months of the current year including current month
LaravelMetrics::query(Order::query())
->sum('amount')
->byMonth(6)
->trends();
// generate total orders amount's sum
LaravelMetrics::query(Order::query())
->sum('amount')
->byYear()
->metrics();
// generate total product count for the current day
LaravelMetrics::query(Product::query())
->count()
->byDay(1)
->metrics();
// generate trends of orders count for the current year
LaravelMetrics::query(Order::query())
->count()
->byMonth(12)
->forYear(now()->year)
->labelColumn('status')
->trends();
// generate total orders amount's sum for the third month only
LaravelMetrics::query(Product::query())
->sum('amount')
->byMonth(1)
->forMonth(3)
->metrics();