PHPackages                             lacodix/laravel-metric-cards - 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. lacodix/laravel-metric-cards

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

lacodix/laravel-metric-cards
============================

Get insights in your laravel applications key business values with metrics visualized as livewire cards.

v0.16.0(2w ago)11.1k↓72.1%MITPHPPHP ^8.2CI passing

Since Apr 23Pushed 2w ago2 watchersCompare

[ Source](https://github.com/lacodix/laravel-metric-cards)[ Packagist](https://packagist.org/packages/lacodix/laravel-metric-cards)[ Docs](https://github.com/lacodix/laravel-metric-cards)[ GitHub Sponsors](https://github.com/lacodix)[ RSS](/packages/lacodix-laravel-metric-cards/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (68)Versions (31)Used By (0)

### DO NOT USE YET

[](#do-not-use-yet)

Work in progress

Assets
------

[](#assets)

The package ships a pre-built, standalone browser bundle (`dist/metrics.js`) that already includes Chart.js (incl. the `Colors` plugin). Host applications do **not**need to install or import Chart.js themselves.

`dist/metrics.js` is committed to the repository and therefore part of every release tag. When you change the source in `resources/js/metrics.js` you must rebuild and commit the bundle:

```
npm ci
npm run build
git add dist/metrics.js
```

CI verifies via `git diff --exit-code dist/metrics.js` that the committed bundle matches the source. Releases are only created when the bundle is up to date.

### Asset publishing

[](#asset-publishing)

Publish the bundle to your application's `public` directory:

```
php artisan vendor:publish --tag=laravel-metrics-assets
```

The metric views automatically include the script exactly once per page, even when several metrics are rendered.

### Config publishing

[](#config-publishing)

Publish the package configuration:

```
php artisan vendor:publish --tag=laravel-metric-cards-config
```

This creates `config/metric-cards.php`.

Chart colors
------------

[](#chart-colors)

Host applications can control the Chart.js colors entirely through `config/metric-cards.php` — without editing or rebuilding `dist/metrics.js`:

```
'chart' => [
    // Chart.js global fallback colors (Chart.defaults.*).
    'defaults' => [
        'background_color' => '#6c5cff',
        'border_color' => '#6c5cff',
        'font_color' => '#111827',
    ],

    // How colors are derived once the palette is exhausted:
    // 'hue' (default), 'lightness' or 'repeat'.
    'color_derivation' => 'hue',

    // Package palette used for pie segments and multiple trend datasets.
    'dataset_colors' => [
        '#6c5cff',
        '#00c2a8',
        '#f59e0b',
        '#ef4444',
    ],

    // Chart.js "Colors" plugin configuration.
    'colors_plugin' => [
        'enabled' => true,
        'force_override' => false,
    ],
],
```

- `defaults` — the global Chart.js fallback colors (`Chart.defaults.backgroundColor`, `Chart.defaults.borderColor`, `Chart.defaults.color`).
- `dataset_colors` — the package palette used for pie segments and for multiple trend datasets. A metric may override it for its own card by filling the `$colors` array on the `Pie` metric; left empty (the default) it follows this palette.
- `color_derivation` — how a chart colors segments once the palette is exhausted. The number of pie segments usually comes from data, so a palette can always be too short. The palette itself is never touched: the first segments of a chart are the palette in its configured order, derivation only starts afterwards.

    - `hue` (default) rotates the hue by the golden angle per palette run — the widest separation, at the price of leaving the color family. Greys, black and white have no hue to rotate, so those are varied by brightness instead.
    - `lightness` keeps the hue and varies the brightness — stays inside the color family, distinguishes less clearly, and because brightness is bounded a heavily recycled palette eventually repeats.
    - `repeat` cycles the palette unchanged.

    A single metric can deviate by setting `protected ?ColorDerivation $colorDerivation`.

    **Derivation only understands hex colors** (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`; transparency is preserved). A palette of `rgb()`, `hsl()` or CSS variables is cycled unchanged — those colors repeat once the palette is exhausted. Use hex values in the palette if a chart may have more segments than the palette has colors.

    An empty palette falls back to the package's built-in one, so legend and canvas always agree on a color.
- `colors_plugin` — configuration for the Chart.js `Colors` plugin. With `force_override = false` (default) the plugin does not overwrite colors that the package already set on a dataset.

These settings are passed from PHP to JavaScript via `window.LaravelMetrics.config`in the package's `_assets.blade.php` view. The Laravel config is the primary override source; any `window.LaravelMetrics.config` set manually before the bundle loads only complements it.

### Upgrading pie metrics

[](#upgrading-pie-metrics)

Two breaking changes come with the per-segment color resolution:

- The pie view renders `$segmentColors` instead of `$colors`. **A published or overridden copy of the old view has to be re-published**, otherwise it reads `$colors`, which is now the (possibly empty) palette rather than one color per segment.
- `Pie::$colors` no longer carries hard-coded colors, so pie charts follow `dataset_colors` like every other chart. A metric that wants its own palette still declares `public array $colors = [...]`.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance98

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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 ~54 days

Recently: every ~12 days

Total

23

Last Release

14d ago

PHP version history (2 changes)v0.0.1PHP ^8.1

v0.13.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/123ffce0596acef2904868164413bca95eeeaa4e2ba557b3620f11fce22cfbb7?d=identicon)[lacodix](/maintainers/lacodix)

---

Top Contributors

[![renky](https://avatars.githubusercontent.com/u/6528960?v=4)](https://github.com/renky "renky (56 commits)")

---

Tags

laravellivewireprogresschartsmetricpiecardslacodixdoughnuttrend

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lacodix-laravel-metric-cards/health.svg)

```
[![Health](https://phpackages.com/badges/lacodix-laravel-metric-cards/health.svg)](https://phpackages.com/packages/lacodix-laravel-metric-cards)
```

###  Alternatives

[leandrocfe/filament-apex-charts

Apex Charts integration for Filament PHP.

4971.7M12](/packages/leandrocfe-filament-apex-charts)[filament/support

Core helper methods and foundation code for all Filament packages.

2333.9M295](/packages/filament-support)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329575.9k33](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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