Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Metric Cards

Laravel Metric Cards Laravel Package

lacodix/laravel-metric-cards

Work-in-progress Laravel package for metric “cards” (dashboard-style metrics). Not ready for production use yet; APIs and features may change.

View on GitHub
Deep Wiki
Context7

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

Frequently asked questions about Laravel Metric Cards
Is lacodix/laravel-metric-cards ready for production use?
No, this package is explicitly marked as **work-in-progress (WIP)** and not ready for production. The README states APIs and features may change, so use it only for testing or non-critical projects. Avoid deploying to live environments.
What Laravel versions does this package support?
The package targets **Laravel 8+ and 9+**, requiring PHP 8.0+. Check the `composer.json` constraints for exact version requirements. Legacy Laravel (pre-8.0) is unsupported due to modern PHP dependencies.
How do I define a basic metric card in this package?
Use the `Metric::create()` method with a name, query, and optional styling. Example: `Metric::create(['name' => 'active_users', 'query' => fn() => User::where('active', true)->count()])`. The package handles rendering via Blade or frontend frameworks like Inertia.js.
Can I use this package with Livewire or Inertia.js?
Yes, the package is designed for **dynamic dashboards** and works seamlessly with Livewire (for server-side reactivity) or Inertia.js (for SPA-like behavior). Ensure your frontend framework supports dynamic visibility toggles for features like invisible metrics.
What are 'invisible values' and how do I enable them?
Invisible values allow metrics to be conditionally hidden (e.g., until thresholds are met). Enable them by adding `'visible' => false` to your metric definition. The frontend must support dynamic visibility (e.g., Vue’s `v-show` or CSS classes).
How do container queries work, and when should I use them?
Container queries group metrics by a field (e.g., `user_segment`) for granular dashboards. Use them for **multi-dimensional analytics**, like comparing metrics across user segments. Example: `Metric::containerQuery(['group_by' => 'segment', 'metrics' => [...]])`.
Will this package cause N+1 query issues with container queries?
Yes, container queries can introduce N+1 risks if not optimized. Mitigate this by **eager loading relationships** (e.g., `with('segment')`) or using Laravel’s query caching. Test with large datasets (10K+ records) to validate performance.
Are there alternatives to this package for Laravel metric cards?
For production-ready alternatives, consider **Laravel Nova’s built-in metrics**, **FilamentPHP’s widgets**, or **custom Blade components** with libraries like Chart.js. If you need WIP flexibility, this package is experimental but may evolve into a solid solution.
How do I test if this package works with my existing Laravel app?
Start by adding it to `composer.json` and publishing the config if needed. Test with a single metric using `php artisan metric-cards:test` (if available) or manually verify Blade/Inertia rendering. Monitor queries with Laravel Debugbar for performance issues.
What should I do if I encounter breaking changes in future updates?
Pin the package version in `composer.json` (e.g., `^0.10.0`) to avoid auto-updates. Monitor the GitHub repo for changelogs and test updates in a staging environment. If major changes occur, refactor your metric definitions incrementally.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope