Download the PHP package hasanhawary/report-builder without Composer
On this page you can find all versions of the php package hasanhawary/report-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hasanhawary/report-builder
More information about hasanhawary/report-builder
Files in hasanhawary/report-builder
Package report-builder
Short Description A modular Laravel report builder for cards, charts, and tables.
License MIT
Homepage https://github.com/hasanhawary/report-builder
Informations about the package report-builder
📊 Laravel Report Builder
A powerful, modular report builder for Laravel that simplifies the generation of cards, charts, and tables.
Easily configurable via config/report.php, it provides a unified JSON structure perfect for HighCharts and modern frontends like Vue, React, or Inertia.
✨ Features
- 🚀 Unified Data Structure: Seamlessly generate cards, charts, and tables.
- 📈 HighCharts Ready: Pre-configured for popular chart types (Bar, Line, Spline, Area, Column, Pie).
- 🧩 Modular & Clean: Define report pages in config and implement logic in dedicated classes.
- 🛠 Dynamic Filtering: Built-in support for date ranges and custom advanced filters.
- 🌍 Multi-language Support: Automatic translation of labels and titles using Laravel's localization.
- 🎨 Frontend Agnostic: Clean JSON response ready for any JS library.
📦 Installation
Publish the configuration files:
The package registers its own routes automatically. By default:
GET /api/report(report.index)
You can disable, move, or rename this route from config/report.php if the host project
already uses the same URLs or route names.
Upgrade Note
If you previously published config/report.php, Composer updates will not overwrite that file.
To use the current default package route GET /api/report, update your published config manually
or republish it:
⚙️ Configuration
Define your report structure in config/report.php:
🛣 Prepared Routes
Report Builder ships its Laravel routes from the package service provider, so host projects do
not need to copy routes or controllers into routes/web.php, routes/api.php, or app/Http.
Default prepared routes:
| Method | URI | Route name | Controller |
|---|---|---|---|
GET |
/api/report |
report.index |
HasanHawary\ReportBuilder\Http\Controllers\ReportController |
The default middleware is ['api'].
For protected report APIs, publish the config and add your auth middleware:
Avoiding Route Conflicts
If your Laravel project already has /api/report or report.index, publish the
config and change the package route settings:
Move the package route under another URL prefix:
This changes the default routes to:
GET /api/report-builder(report-builder.index)
You can also change only the individual paths and names:
Or disable the package routes completely if you only want to instantiate ReportBuilder
directly:
Route configuration is merged with package defaults, so a host project can override only the
values it needs. Setting middleware to an empty array is supported when you need public or
API-only routes:
🛠 Usage
1. Create your Report Class
Extend BaseReport and implement methods matching your config keys (prefixed with get).
2. Fetch the Report
Use the package route or instantiate ReportBuilder directly.
📊 Available Response Helpers
Inside your report classes, use these helpers to format data:
$this->cardResponse($data): Formats simple key-value pairs into card data.$this->chartResponse($groupByField, $data): Formats collections into HighCharts-ready structures.$this->guessDateFormat(): Automatically determines the best date format for chart axes based on filtered range.
🌍 Localization
The package reads report titles, card labels, chart categories, chart series names, and table columns from the configured translation file:
With the default value, label keys like total_users are resolved from:
To use another file, set trans_file:
Then the same key is resolved from:
🎨 Frontend Integration
JSON Response
Calling GET /api/report?page=user returns a JSON envelope. Frontend chart and card data lives
under data.report.
Vue 3 + Highcharts
✅ Version Support
- PHP: 8.0+
- Laravel: 10, 11, 12, 13
Runtime Boundary
This package is designed for Laravel applications. The route, controller, request validation, translation, database helpers, and service provider are Laravel-only features and require a Laravel application container.
The package does not depend on any App\... class by default. Host applications provide report
classes either with report.namespace or with a page-specific report.pages.{page}.class.
If no report class is configured, the package returns a clear configuration error instead of
assuming an application namespace.
Plain PHP projects can reuse simple data-shaping ideas from the package, but the shipped
implementation expects Laravel helpers such as config(), app(), trans(), and Laravel's
database/query components. In non-Laravel runtimes, use this package behind a Laravel adapter
or provide your own wrapper around the report classes.
📜 License
MIT © Hasan Hawary