File tree Expand file tree Collapse file tree 1 file changed +47
-1
lines changed Expand file tree Collapse file tree 1 file changed +47
-1
lines changed Original file line number Diff line number Diff line change 1- ## A fast and tiny PHP library to export data to csv, excel etc.
1+ ## Overview
2+ A fast and tiny PHP library to export data to csv, excel etc.
3+ The library is based of PHP generator. It used only 20MB memory
4+ to download 5 Million data. Tested on Laravel 6.
5+
6+ ### Installation
7+ ``` $xslt
8+ composer require sujan/exporter
9+ ```
10+
11+ ## Usage
12+ `use Sujan\Exporter\Export
13+ `
14+ ``` $xslt
15+ $columns = [
16+ 'id',
17+ 'name',
18+ 'email'
19+ ];
20+
21+ $exporter = new Export(
22+ User::query(),
23+ $columns
24+ );
25+
26+ $exporter->export();
27+ ```
28+
29+ ** For eloquent relation**
30+ ``` $xslt
31+ $columns = [
32+ 'id',
33+ 'title',
34+ 'user' => [ // user is a relation
35+ 'name'
36+ ]
37+ ];
38+
39+ $exporter = new Export(
40+ Post::with('user'),
41+ $columns
42+ );
43+
44+ $exporter->export();
45+ ```
46+
47+ Where ` user ` is the relation name, which is same as is in the ` $columns ` variable.
You can’t perform that action at this time.
0 commit comments