PHPackages                             devhereco/custom-chart - 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. devhereco/custom-chart

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

devhereco/custom-chart
======================

A Laravel package to extract data from any model to imploment it to your custom chart.

2.2(1y ago)045MITPHP

Since Dec 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/devhereco/LaravelCustomChart)[ Packagist](https://packagist.org/packages/devhereco/custom-chart)[ RSS](/packages/devhereco-custom-chart/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)DependenciesVersions (4)Used By (0)

CustomChart
===========

[](#customchart)

**CustomChart** is a Laravel package that allows you to generate customizable chart data from your Eloquent models. It supports various aggregate functions and flexible date filtering options.

[![stars](https://camo.githubusercontent.com/cfe7812f57bdc8eea55965e6ec94f949666343a112e305b83cc1af1be62ad6ef/68747470733a2f2f62616467656e2e6e65742f6769746875622f73746172732f64657668657265636f2f4c61726176656c437573746f6d4368617274)](https://github.com/devhereco/LaravelCustomChart)[![contributors](https://camo.githubusercontent.com/7849add10488287c010f16ecec4708241a4f48284c390975da17fb58d9aa1a34/68747470733a2f2f62616467656e2e6e65742f6769746875622f636f6e7472696275746f72732f64657668657265636f2f4c61726176656c437573746f6d4368617274)](https://github.com/devhereco/LaravelCustomChart)[![releases](https://camo.githubusercontent.com/8c69cba4f1f2c65bbde9754e01b6fe73213bf9206187f51fd2c00927672aa097/68747470733a2f2f62616467656e2e6e65742f6769746875622f72656c65617365732f64657668657265636f2f4c61726176656c437573746f6d4368617274)](https://github.com/devhereco/LaravelCustomChart)[![issues](https://camo.githubusercontent.com/bf18959902b93c13f7007f527266139431c75b31c13f378cdf42f9c9298220ce/68747470733a2f2f62616467656e2e6e65742f6769746875622f6f70656e2d6973737565732f64657668657265636f2f4c61726176656c437573746f6d4368617274)](https://github.com/devhereco/LaravelCustomChart)

---

Simple Usage
------------

[](#simple-usage)

### 1. Generate Chart Data

[](#1-generate-chart-data)

This function generates the data you will need to use for any chart.

**Controller**:

```
use Devhereco\CustomChart\CustomChart;

// ...

$chart = CustomChart::create(
    User::class,
    'Registered Users Per Day',
    'count',
    'id',
    7,
    'days'
);

return $chart;
```

**Sample Output:**

```
{
    "name": "Registered Users Per Day",
    "data": {
        "2022-12-19": 12,
        "2022-12-20": 15,
        "2022-12-21": 23,
        "2022-12-22": 52,
        "2022-12-23": 41,
        "2022-12-24": 12,
        "2022-12-25": 15,
        "2022-12-26": 73
    },
    "this_month": 243,
    "last_month": 200,
    "this_year": 2430,
    "last_year": 2000,
    "percentage_change": {
        "this_month": {
            "value": "21.50%",
            "status": "positive"
        },
        "last_month": {
            "value": "10.00%",
            "status": "positive"
        },
        "this_year": {
            "value": "21.50%",
            "status": "positive"
        }
    },
    "total": 243
}
```

---

Installation
------------

[](#installation)

### 1. Require with Composer

[](#1-require-with-composer)

```
composer require devhereco/custom-chart
```

### 2. Add Service Provider (Laravel 5.4 and below)

[](#2-add-service-provider-laravel-54-and-below)

Latest Laravel versions have auto-discovery and automatically add the service provider. If you're using Laravel 5.4.x and below, remember to add it to the providers array in /app/config/app.php:

```
// ...
Devhereco\CustomChart\ServiceProvider::class,
```

---

Available Reports and Options
-----------------------------

[](#available-reports-and-options)

The package currently supports various types of charts/reports:

OptionDescription`model` (required)The name of the Eloquent model to take data from.`title` (optional)A text title that will be passed with the data for cleaner and easier usage.`aggregate_function`You can view not only the count of records but also their `SUM()` or `AVG()`. Possible values: "count" (default), "avg", "sum".`aggregate_field`The name of the field to use in `SUM()` or `AVG()` functions. Irrelevant for `COUNT()`.`filter_count`Show only the last `filter_count` intervals (e.g., days, weeks, months, years) of the specified field.`filter_interval`The interval for filtering data. Possible values: "days" (default), "weeks", "months", "years".`show_total`Boolean value to show the total values for all selected intervals.`date_format`The date format, by default: American format Y-m-d.**NOTE:** From Laravel 8, all models are placed in a folder called `Models` (e.g., `App\Models\...`).

---

Example with all options
------------------------

[](#example-with-all-options)

### Controller:

[](#controller)

```
use Devhereco\CustomChart\CustomChart;

// ...

$chart = CustomChart::create(
    User::class,
    'Registered Users Per Day',
    'count',
    'id',
    7, // Show last 7 days/weeks/months/years
    'days', // Interval type
    true, // Show total
    'Y-m-d'
);

return $chart;
```

### Sample Output:

[](#sample-output)

```
{
    "name": "Registered Users Per Day",
    "data": {
        "2022-12-19": 12,
        "2022-12-20": 15,
        "2022-12-21": 23,
        "2022-12-22": 52,
        "2022-12-23": 41,
        "2022-12-24": 12,
        "2022-12-25": 15,
        "2022-12-26": 73
    },
    "this_month": 243,
    "last_month": 200,
    "this_year": 2430,
    "last_year": 2000,
    "percentage_change": {
        "this_month": {
            "value": "21.50%",
            "status": "positive"
        },
        "last_month": {
            "value": "10.00%",
            "status": "positive"
        },
        "this_year": {
            "value": "21.50%",
            "status": "positive"
        }
    },
    "total": 243
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~269 days

Total

3

Last Release

697d ago

Major Versions

1.4 → 2.02023-12-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/540d5e198a3e5937f814e36b23345ed9aadb6e53fd5cb138f2c73cac11b4c252?d=identicon)[devhereco](/maintainers/devhereco)

---

Top Contributors

[![mbs047](https://avatars.githubusercontent.com/u/38505129?v=4)](https://github.com/mbs047 "mbs047 (15 commits)")

---

Tags

laravelpackagechartcustom

### Embed Badge

![Health badge](/badges/devhereco-custom-chart/health.svg)

```
[![Health](https://phpackages.com/badges/devhereco-custom-chart/health.svg)](https://phpackages.com/packages/devhereco-custom-chart)
```

###  Alternatives

[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
