Skip to content
Create excel reports, from any data structure (collection, array, objects) with a line of code!
PHP
Branch: master
Clone or download
Latest commit 2b4d00d Jan 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src First commit Jan 18, 2019
.gitignore First commit Jan 18, 2019
README.md Update README.md Jan 18, 2019
composer.json Update composer.json Jan 19, 2019

README.md

excel-reporter

Create excel reports, from any data structure (collection, array, objects) with a line of code!

Installation

composer require xerobase/excel-reporter

Usage

Create an instance of Export class

$exporter = new \Xerobase\ExcelReporter\Export();

You can simply export your data by calling export method :

// Your source can be an Eloquent Model
$books = \App\Models\Book::all();

// Or an associative array
$books = [
  'Title' => 'Foo',
  'Author' => 'Bar'
];

// Or an stdClass object
$books = new stdClass();
$books->title = 'Foo';
$books->author = 'Bar';

$exporter->export($books);

Maybe want to filter some of unnecessary fields :

$exporter->filterColumns(['id', 'created_at', 'updated_at'])->export($books);

Set direction to RTL :

$exporter->setRightToLeft()->export($books);

Or change format to CSV :

$exporter->setFormat('csv')->export($books);
You can’t perform that action at this time.