deifhelt / laravel-reports
Reports for Laravel.
Fund package maintenance!
v1.0.0
2026-01-28 08:25 UTC
Requires
- php: ^8.2
- barryvdh/laravel-dompdf: ^3.1
- illuminate/contracts: ^10.0||^11.0||^12.0
- illuminate/support: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.34 || ^3.0
- laravel/pint: ^1.10
- nunomaduro/collision: ^7.0 || ^8.0
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0
- pestphp/pest: ^2.0 || ^3.0
- pestphp/pest-plugin-arch: ^2.0 || ^3.0
- pestphp/pest-plugin-laravel: ^2.0 || ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^1.0 || ^2.0
- phpstan/phpstan-phpunit: ^1.0 || ^2.0
- spatie/laravel-ray: ^1.35
README
Overview
Laravel Reports is a small, opinionated wrapper around barryvdh/laravel-dompdf that helps you generate PDFs using a consistent report class pattern.
Instead of scattering PDF logic across controllers/routes, you define a report once (query + view + filename) and let the package handle rendering and response mode.
What it provides
- Report definitions via
ReportDefinition(query + view + filename) - Single entrypoint via
LaravelReports::process() - Automatic response mode:
?preview=1or?stream=1streams in the browser- no flag downloads the PDF
- Optional dataset limit validation to protect against huge exports
- Safe view variables (
filtersare query-string only) - Pluggable renderer via
PdfRenderer(DomPDF by default) - Optional NativePHP preview helper (
PreviewWindowReportManager) for open window then stream PDF flows
Installation
composer require deifhelt/laravel-reports
Publish the configuration:
php artisan vendor:publish --tag="laravel-reports-config"
DomPDF settings (fonts, remote assets, security, etc.) are configured in your app via config/dompdf.php.
Public API (most used)
LaravelReports::process($report, $request, $title = 'Report')LaravelReports::stream($report, $request)LaravelReports::download($report, $request)
Documentation
Notes
- This package ships with an example migration stub via package tools; PDF rendering does not require a database table.
Credits
License
This package is open-source software licensed under the MIT license.