Export Views from Laravel applications to PDF or Excel files.
You can install the package via composer:
composer require sfneal/view-export
To modify the view-export config file publish the ServiceProvider.
php artisan vendor:publish --provider="Sfneal\ViewExport\Providers\ViewExportServiceProvider"
Exporting a PDF from a 'view'.
use Sfneal\ViewExport\Pdf\PdfExportService;
// Set the view & upload path
$view = view('your.view', ['example_data' => ['a'=> 2001, 'b' => 3012]]);
$s3Key = 'path/to/save/your/file/example.pdf';
// Initialize an Exporter instance
$exporter = PdfExportService::fromView($view)->handle();
// Upload the PDF
$exporter->upload($s3Key);
// Download in browser
$exporter->download();
// Retrieve the upload path
$path = $exporter->path();
Exporting an Excel file from a 'view'.
use Sfneal\ViewExport\Excel\ExcelExportService;
// Set the view & upload path
$view = view('your.view', ['example_data' => ['a'=> 2001, 'b' => 3012]]);
$s3Key = 'path/to/save/your/file/example.pdf';
// Initialize an Exporter instance
$exporter = ExcelExportService::fromView($view)->handle();
// Upload the PDF
$exporter->upload($s3Key);
// Download in browser
$exporter->download();
// Retrieve the upload path
$path = $exporter->path();
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate.