mitoteam/jpgraph
Composer package for the JpGraph 4.4.3 library with PHP 5.5–8.5 support. Provides a simple loader (MtJpGraph::load) to include JpGraph and selected modules (bar, line, etc.) anywhere in your code, avoiding duplicate loads.
Server-Side Data Visualization in Laravel Ecosystem:
Artisan commands or Queue jobs to automate report generation (e.g., nightly sales performance charts)./api/charts/revenue) for SPAs, mobile apps, or third-party integrations. Reduce client-side complexity by offloading rendering to the server.scheduler or Artisan commands for internal tools (e.g., monitoring dashboards, audit logs).Build vs. Buy for Analytics Features:
include statements with MtJpGraph::load(['bar', 'line']).TTF_DIR, CACHE_FILE_GROUP) via define() before loading, ensuring safe, configurable behavior without modifying the library.Roadmap Prioritization:
pie, line, bar). Example: Use Extended Mode to patch bugs while enabling tenant-specific styling.Extended Mode with Laravel’s config() system. Example:
define('JPG_COLORS', config('tenants.' . $tenant->id . '.chart_colors'));
MtJpGraph::load(['pie'], true);
App\Jobs\GenerateChartJob.Use Cases:
// AdminController.php
public function dashboard() {
MtJpGraph::load(['line', 'pie']);
$graph = new Graph(800, 400);
// ... render chart ...
return view('admin.dashboard', ['chart' => $graph->stroke()]);
}
// routes/api.php
Route::get('/charts/revenue', function () {
MtJpGraph::load(['bar']);
$graph = new Graph(600, 300);
// ... populate data ...
return response($graph->stroke(), 200, ['Content-Type' => 'image/png']);
});
// app/Jobs/GenerateMonthlyReport.php
public function handle() {
MtJpGraph::load(['line']);
$chart = $this->generateChart();
Mail::to('reports@company.com')->send(new ChartEmail($chart));
}
Adopt This Package If:
bar, line) on demand.define() overrides before loading.Look Elsewhere If:
For Executives: "This package lets us generate high-quality, server-rendered charts in Laravel without licensing costs or client-side dependencies. It’s ideal for PDF reports, email analytics, or API-driven dashboards—use cases where client-side libraries like Chart.js fall short. By modularizing JpGraph’s loading, we reduce bundle size and improve performance, while PHP 8.5 support ensures long-term compatibility. It’s a cost-effective way to deliver data visualization features quickly, especially for headless environments like scheduled reports or CLI tools."
For Engineering Teams: *"This is a Composer-friendly wrapper for JpGraph that solves two key problems:
bar, line) to optimize performance. The Extended Mode option lets us patch JpGraph bugs safely without forking the library.
It integrates seamlessly with Laravel’s ecosystem—use it in controllers, queues, or APIs—and supports customization via define() before loading. Perfect for server-side rendering where client-side libraries aren’t an option."*For Developers: *"Need to generate charts in Laravel without JavaScript? This package wraps JpGraph with Composer support, PHP 8.5 fixes, and lazy-loading modules. Key perks:
composer require mitoteam/jpgraph + MtJpGraph::load(['bar', 'line']).define() before loading (e.g., define('TTF_DIR', storage_path('fonts'))).load() multiple times—it won’t duplicate files.MtJpGraph::load([...], true).
Use it for PDFs, emails, APIs, or CLI tools where client-side rendering isn’t possible."*How can I help you explore Laravel packages today?