Download the PHP package coolsam/laravel-report-generator without Composer
On this page you can find all versions of the php package coolsam/laravel-report-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coolsam/laravel-report-generator
More information about coolsam/laravel-report-generator
Files in coolsam/laravel-report-generator
Package laravel-report-generator
Short Description Rapidly Generate Simple Pdf & Excel Report on Laravel 5 (Using Barryvdh/DomPdf or Barryvdh/laravel-snappy & maatwebsite/excel)
License MIT
Informations about the package laravel-report-generator
Laravel Report Generators (PDF, CSV & Excel)
Rapidly Generate Simple Pdf Report on Laravel (Using barryvdh/laravel-dompdf or barryvdh/laravel-snappy) or CSV / Excel Report (using Maatwebsite/Laravel-Excel)
This package provides a simple pdf, csv & excel report generators to speed up your workflow
Installation
Add package to your composer:
composer require coolsam/laravel-report-generator
If you are running Laravel > 5.5 that's all you need to do. If you are using Laravel < 5.5 add the ServiceProvider to the providers array in config/app.php
Coolsam\ReportGenerator\ServiceProvider::class,
Optionally, you can add this to your aliases array in config/app.php
'PdfReport' => Coolsam\ReportGenerator\Facades\PdfReportFacade::class,
'ExcelReport' => Coolsam\ReportGenerator\Facades\ExcelReportFacade::class,
'CSVReport' => Coolsam\ReportGenerator\Facades\CSVReportFacade::class,
For more better speed on generating pdf report, I recommend you to use laravel snappy package. To using laravel snappy, you should install wkhtmltopdf
to work with this package (Jump to wkhtmltopdf installation)
Information
This package can use either cursor
or chunk
method (Eloquent / Query Builder) so it can handle big data faster than chunk and minimizing memory usage.
Method | On Version |
---|---|
chunk() | 1.0.* |
cursor() | ^1.1.0 |
Find the comparison between chunk
and cursor
in here
Also, You can use PdfReport
, ExcelReport
or CSVReport
facade for shorter code that already registered as an alias.
Example Display PDF Code
Note: For downloading to excel / CSV, just change PdfReport
facade to ExcelReport
/ CSVReport
facade with no more modifications
Data Manipulation
Will produce a same result with:
Report Output
With this manipulation, you could do some eager loading relation like:
Example Code With Group By
Or, you can total all records by group using groupBy
method
PLEASE TAKE NOTE TO SORT GROUPBY COLUMN VIA QUERY FIRST TO USE THIS GROUP BY METHOD.
Output Report With Group By Registered At
Wkhtmltopdf Installation
- Download wkhtmltopdf from https://wkhtmltopdf.org/downloads.html
- Change your snappy config located in
/config/snappy.php
(runphp artisan vendor:publish
ifsnappy.php
file is not created) to:
Other Method
1. setPaper($paper = 'a4')
Supported Media Type: PDF
Description: Set Paper Size
Params:
- $paper (Default: 'a4')
Usage:
2. setCss(Array $styles)
Supported Media Type: PDF, Excel
Description: Set a new custom styles with given selector and style to apply
Params:
- Array $styles (Key: $selector, Value: $style)
Usage:
3. setOrientation($orientation = 'portrait')
Supported Media Type: PDF
Description: Set Orientation to Landscape or Portrait
Params:
- $orientation (Default: 'portrait')
Usage:
4. withoutManipulation()
Supported Media Type: PDF, Excel, CSV
Description: Faster generating report, but all columns properties must be matched the selected column from SQL Queries
Usage:
5. showMeta($value = true)
Supported Media Type: PDF, Excel, CSV
Description: Show / hide meta attribute on report
Params:
- $value (Default: true)
Usage:
6. showHeader($value = true)
Supported Media Type: PDF, Excel, CSV
Description: Show / hide column header on report
Params:
- $value (Default: true)
Usage:
7. showNumColumn($value = true)
Supported Media Type: PDF, Excel, CSV
Description: Show / hide number column on report
Params:
- $value (Default: true)
Usage:
8. simple()
Supported Media Type: Excel
Description: Generate excel in simple mode (no styling on generated excel report, but faster in generating report)
Params:
- None
Usage: