moirei / eloquent-metrics
Retrieve metric data on Eloquent Models for analytics.
0.3.2
2024-08-05 12:22 UTC
Requires
- php: ^7.2|^8.0
- cakephp/chronos: ^2.3
- illuminate/database: ^7.0|^8.0|^9.0
- illuminate/support: ^7.0|^8.0|^9.0
- laravel/helpers: ^1.5
Requires (Dev)
- orchestra/testbench: ^6.17
- phpunit/phpunit: ^9.5
README
All documentation is available at the documentation site.
Example
... use MOIREI\Metrics\Trend; $metrics = Trend::make() ->name('Order Sales') ->period('week') // sample a week ago intil now ->add('previous-period') // add a comparison period ->sumByDays(\App\Models\Order::class, 'total');
Example with moirei/hogql
... $query = HogQl::eloquent()->where('event', '$pageview'); $metrics = Trend::make() ->name('Page views') ->period('week') ->add('previous-period') ->sumByDays($query);
Installation
composer require moirei/eloquent-metrics
Changelog
Please see CHANGELOG.
Credits
License
The MIT License (MIT). Please see License File for more information.