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

Livecharts Laravel Package

matheusmarnt/livecharts

LiveCharts is a reactive chart abstraction for Laravel using a pure PHP fluent API. Build 18 chart types and render via a single Livewire component. Supports ApexCharts and Chart.js with pluggable engines, enabling easy updates without JS boilerplate.

View on GitHub
Deep Wiki
Context7

Reactive charts for Laravel Livewire — pure PHP, multi-engine (ApexCharts + Chart.js), zero JavaScript required.

Frequently asked questions about Livecharts
How do I install LiveCharts in a Laravel 13 project with Livewire 4?
Run `composer require matheusmarnt/livecharts` followed by `php artisan livecharts:install`. This publishes config, assets, and stubs. Ensure your Laravel version is 10–13 and Livewire is 3–4. The installer handles asset registration automatically for local or CDN modes.
Can I use LiveCharts with Laravel Vite for optimized asset delivery?
Yes, LiveCharts supports Vite out of the box. Configure `LIVECHARTS_ASSETS_MODE=both` in your `.env` to use both local and CDN assets. The package includes Vite-compatible directives for seamless integration with Laravel’s modern asset pipeline.
What chart types are available, and how do I customize them?
LiveCharts offers 18 chart types, including line, bar, pie, treemap, and candlestick charts. Customize them via the fluent API (e.g., `LiveCharts::line()->labels()->dataset()->colors()`) or by extending the `Chart` class. Engine-specific features like ApexCharts’ `strokeDashArray` can be exposed via the `withEngineConfig()` method.
How does LiveCharts handle real-time updates with Livewire?
LiveCharts leverages Livewire’s reactivity model. When chart data changes (e.g., via `wire:model` or `wire:poll`), the component re-renders automatically. For advanced use cases, integrate with Laravel Echo for broadcasting updates via WebSocket channels, ensuring low-latency reactivity.
Is LiveCharts compatible with multi-tenancy or SaaS applications?
Yes, but broadcasting requires careful channel management. Use `broadcastOn()` with tenant-specific channels (e.g., `private-tenant.{id}.chart-updates`) to isolate updates. Ensure your WebSocket provider (Pusher, Ably) scales with your tenant count to avoid race conditions or throttling.
What’s the best way to handle large datasets (e.g., 10K+ data points) without performance issues?
For large datasets, enable pagination or lazy-loading in your data source. LiveCharts supports virtual scrolling for charts like treemap or matrix via engine-specific optimizations (e.g., ApexCharts’ `chartOptions['plugins']['scrollbar']`). Test with `wire:lazy` or `wire:poll` to minimize hydration cycles.
How do I add a custom chart engine like Highcharts or ECharts?
Implement the `EngineAdapter` contract and register it via `LiveCharts::registerEngine()`. The adapter must handle engine-specific configurations, plugins, and asset loading. Example: `LiveCharts::registerEngine(new HighchartsAdapter());`. Check the package’s `src/Engines` directory for reference implementations.
What’s the recommended CI/CD strategy for asset publishing?
Automate asset publishing in your deployment pipeline. For GitHub Actions, add a step to run `php artisan livecharts:publish --tag=assets` before `npm run build`. For Docker, ensure `public/vendor/livecharts/js/` is copied during build. Use `LIVECHARTS_ASSETS_MODE=cdn` in production to avoid silent failures from missing assets.
How does LiveCharts handle errors, like missing data or invalid configurations?
LiveCharts validates chart configurations during hydration and throws exceptions for invalid data or engine errors. Use `@error` directives in Blade to display user-friendly messages. For graceful fallbacks, implement a `ChartFallback` trait or override the `render()` method to return a static placeholder (e.g., a loading spinner).
Are there alternatives to LiveCharts for Laravel Livewire charts?
Alternatives include `beyondcode/laravel-apexcharts` (ApexCharts-focused) or `chartjs/chart.js` with manual Livewire integration. LiveCharts stands out by offering a unified PHP API for multiple engines, reducing boilerplate, and integrating natively with Livewire’s reactivity. For JavaScript-heavy projects, consider `laravel-chartjs` but expect more frontend complexity.
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity