manggala / laravel-dashboard-builder
Production-ready open-source dashboard builder package for Laravel applications.
Package info
github.com/IlhamHattaManggala/laravel-dashboard-builder
Language:JavaScript
pkg:composer/manggala/laravel-dashboard-builder
Requires
- php: ^8.3
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/database: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- inertiajs/inertia-laravel: ^1.0|^2.0|^3.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
Laravel Dashboard Builder (manggala/laravel-dashboard-builder) is a production-ready, highly modular, open-source dashboard builder package for Laravel applications.
It allows developers to create stunning, interactive, responsive dashboards visually through a drag-and-drop React/Inertia builder or programmatically using an expressive, fluent PHP API.
๐ Key Features
- Laravel & PHP Support: Fully compatible with Laravel 11.x, 12.x, and 13.x (PHP 8.3+) & Inertia.js v1, v2, v3.
- Interactive Drag-and-Drop Canvas: Visual layout canvas editor with interactive widget positioning (move up/down/left/right) & dynamic resizing handles.
- Global Date Range Picker: Centralized date range filtering (All Time, Today, Last 7 Days, This Month, Last 30 Days) propagated across widgets.
- Export Options: Export visual dashboards to PNG/PDF print documents & JSON schema.
- Visual Query Builder Inspector: Configure Model/Table sources, Aggregation Functions (
COUNT,SUM,AVG,MAX,MIN), target columns, and Date Grouping (groupByDay,groupByMonth,groupByYear) visually from the inspector UI. - RBAC & Policy Authorization: Native Laravel Gate/Policy integration (
DashboardPolicy) for fine-grained viewer vs editor access control. - Fluent PHP Builder API: Expressive
Dashboard::make('Sales')syntax inspired by Spatie & Filament. - Dynamic Data Source Drivers: Query Eloquent Models, DB Query Builder, Memory Collections, Raw SQL, JSON files, or REST API endpoints with caching support.
- Artisan Generators & Auto-Publish Views: Generator commands
make:dashboard,make:dashboard-widget, and publish tags for Inertia pages (dashboard-builder-views).
๐ฆ Installation
Install the package via Composer:
composer require manggala/laravel-dashboard-builder
Run the package installation command to publish configuration, database migrations, assets, and Inertia React page views:
php artisan dashboard:install
Optionally publish resources individually:
php artisan dashboard:publish --tag=config php artisan dashboard:publish --tag=migrations php artisan dashboard:publish --tag=assets php artisan dashboard:publish --tag=views
๐ Authorization (Role-Based Access Control)
The package automatically registers DashboardPolicy for authorization. You can authorize actions in your application controller or gates:
use Manggala\DashboardBuilder\Models\Dashboard; use Illuminate\Support\Facades\Gate; // Check authorization before rendering or editing Gate::authorize('update', $dashboard);
๐ Quick Start (Fluent PHP API)
Define dashboards fluently in PHP:
use Manggala\DashboardBuilder\Facades\Dashboard; use Manggala\DashboardBuilder\Widgets\Stats\CardWidget; use Manggala\DashboardBuilder\Widgets\Charts\LineChartWidget; use Manggala\DashboardBuilder\Widgets\Special\TableWidget; use App\Models\User; use App\Models\Order; $salesDashboard = Dashboard::make('Sales & Revenue') ->description('Monthly sales metrics and performance breakdown') ->widget( CardWidget::make('Total Users') ->model(User::class) ->count() ->icon('users') ->width(3) ->height(2) ) ->widget( LineChartWidget::make('Revenue Trend') ->model(Order::class) ->sum('total_amount') ->groupByMonth() ->width(6) ->height(4) ) ->widget( TableWidget::make('Recent Orders') ->table('orders') ->columns(['id', 'user_id', 'total_amount', 'status']) ->perPage(5) ->width(12) ); // Convert to array or JSON payload $payload = $salesDashboard->toArray();
๐ ๏ธ Artisan Commands
Generate new dashboards, custom widgets, or publish resources:
# Generate a new Dashboard class in app/Dashboards/ php artisan make:dashboard SalesDashboard # Generate a new custom Widget class in app/Dashboards/Widgets/ php artisan make:dashboard-widget RevenueWidget # Clear cached widget datasets php artisan dashboard:clear-cache
๐งช Testing & Code Quality
Run the automated test suite using Pest PHP:
vendor/bin/pest
Check code formatting with Laravel Pint:
vendor/bin/pint --test
Build production frontend assets:
npm run build
๐ License
The MIT License (MIT). Please see LICENSE for more information.