This package helps you to export a data resource from an api that returns a Laravel pagination payload (including bootstrap 3 payload).
Currently it is exporting for CSV, but any PR is welcome =)
Add package
composer require thiagovictorino/laravel-resource-exporter
To create configuration file run:
php artisan vendor:publish --provider="Victorino\ResourceExporter\ResourceExporterServiceProvider"
/**
* Getting the export builder
*/
$exporter = \ResourceExporter::endpoint('http://yourl.com/resource?anyfilters');
/**
* optional: Set the Bearer Token on request
*/
$exporter->withBearerToken('abcd123');
/**
* optional: Set the payload as a Bootstrap 3 standard. You can set it automatically
* on configurations
*/
$exporter->withBootstrapThree();
/**
* optional: Add a delay between each requests
*/
$exporter->withDelay(5);
/**
* Will save the file on disk that was set on configurations
*/
$exporter->toCSV('my-file-name');
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 eu [at] thiagovictorino.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.