Skip to content
/ report Public

Producing excel table out of laravel collections

Notifications You must be signed in to change notification settings

waxwink/report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Report

this package wraps around the php office spreadsheet to produce excel tables out of laravel collections.

Getting Started

Install the package with composer :

$ composer require waxwink/report

Instruction

Here is an examples to use the package :

use Illuminate\Support\Collection;
use Waxwink\Report\Excel;

require __DIR__."/vendor/autoload.php";

$keys = [
    'id'=> 'Product ID',
    'name'=> 'Name',
    'price'=> 'Price',
];

$collection = new Collection([
    [
        'id'=> '1574',
        'name'=> 'Phone',
        'price'=> '100',],
    [
        'id'=> '6541',
        'name'=> 'Printer',
        'price'=> '150',
    ],
    [
        'id'=> '9652',
        'name'=> 'Laptop',
        'price'=> '350',
    ],
    [
        'id'=> '6971',
        'name'=> 'Mouse',
        'price'=> '30',
    ]
]);

$xl = new Excel($collection, $keys);

//this would save the file in the root folder : table.xlsx
$xl->export('table');

you can also send the file to the client to download. :

// (works only if you're using laravel)
return response()->download($xl->update());

About

Producing excel table out of laravel collections

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages