Download the PHP package jk-oster/laravel-collection-trend without Composer
On this page you can find all versions of the php package jk-oster/laravel-collection-trend. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jk-oster/laravel-collection-trend
More information about jk-oster/laravel-collection-trend
Files in jk-oster/laravel-collection-trend
Package laravel-collection-trend
Short Description Generate trends from collections. Easily create charts or reports.
License MIT
Homepage https://github.com/jk-oster/laravel-collection-trend
Informations about the package laravel-collection-trend
Collection Trend for Laravel
Generate trends from collections. Easily create charts or reports.
For detailed examples checkout the docs page.
Why?
Most applications require charts or reports to be generated. Doing this over again, and again can be a painful process. That's why I've created a fluent Laravel package to solve this problem (inspired by laravel-trend).
Installation & Setup
You can install this package with composer using the following command:
Usage
To generate a trend for your model, import the JkOster\CollectionTrend\CollectionTrend
class and pass along a collectable.
Example:
Starting a trend
You can either start a trend using ::make()
or ::collect()
.
Interval
You can use the following aggregates intervals:
Aggregates
You can use the following aggregates:
Date Column
By default, laravel-collection-trend assumes that the model on which the operation is being performed has a created_at
date column. If your model uses a different column name for the date or you want to use a different one, you should specify it using the dateColumn(string|Closure $column)
method.
Example:
This allows you to work with models that have custom date column names or when you want to analyze data based on a different date column.
Value Column
By default laravel-collection-trend you have to specify the column that contains the values you want to aggregate in the aggregate method. Like the date column you can specify it using a string|Closure
which you pass in the aggregate method.
Example:
Empty Data Fillers
By default laravel-collection-trend fills up missing data with the value 0
. You can change this behavior by passing a int
as second argument to the aggregate method.
Example:
Compatibility with Flowframe/Laravel-Trend
The interface of the package to the biggest part compatible with the Laravel-Trend package. You only need to exchange the calls with .
License
The MIT License (MIT). Please see License File for more information.
Credits
Thanks to the creators of flowframe/laravel-trend for inspiration.
- Jakob Osterberger
- All Contributors
All versions of laravel-collection-trend with dependencies
illuminate/contracts Version ^10.0||^11.0
illuminate/support Version ^10||^11
spatie/laravel-package-tools Version ^1.16