Package Data | |
---|---|
Maintainer Username: | racklin |
Maintainer Contact: | racklin@gmail.com (Rack Lin) |
Package Create Date: | 2017-08-02 |
Package Last Update: | 2018-07-16 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:06:54 |
Package Statistics | |
---|---|
Total Downloads: | 1,098 |
Monthly Downloads: | 2 |
Daily Downloads: | 1 |
Total Stars: | 3 |
Total Watchers: | 2 |
Total Forks: | 3 |
Total Open Issues: | 1 |
Simple Excel Generator for Laravel using phpexcel library.
This package using json as template and you can pass php array as data to generate Excel xlsx.
{
"require": {
"racklin/excel-generator": "dev-master"
}
}
Next, add the service provider to config/app.php
.
'providers' => [
//...
Racklin\ExcelGenerator\ServiceProvider::class,
]
//...
'aliases' => [
//...
'ExcelGen' => Racklin\ExcelGenerator\Facades\ExcelGenerator::class
]
$excel = new ExcelGenerator();
$excel->generate('example_01.json', ["name"=>"rack", "cname"=>"阿土伯", "data"=> [
["a"=>"A1", "b"=>"B1"],
["a"=>"A2", "b"=>"B2"],
["a"=>"A3", "b"=>"B2"],
["a"=>"A4", "b"=>"B2"],
["a"=>"A5", "b"=>"B2"],
["a"=>"A6", "b"=>"B2"],
["a"=>"A7", "b"=>"B2"],
["a"=>"A8", "b"=>"B2"],
["a"=>"A9", "b"=>"B2"],
]], '/tmp/example_01.xlsx', 'F');
ExcelGen::generate('example_01.json', ["name"=>"rack", "cname"=>"阿土伯", "data"=> [
["a"=>"A1", "b"=>"B1"],
["a"=>"A2", "b"=>"B2"],
["a"=>"A3", "b"=>"B2"],
["a"=>"A4", "b"=>"B2"],
["a"=>"A5", "b"=>"B2"],
["a"=>"A6", "b"=>"B2"],
["a"=>"A7", "b"=>"B2"],
["a"=>"A8", "b"=>"B2"],
["a"=>"A9", "b"=>"B2"],
]], '/tmp/example_01.xlsx', 'F');
Current package version works for Laravel 5+.
MIT: https://racklin.mit-license.org/