Skip to content

Commit 4914e9b

Browse files
committed
doc updated
1 parent 5c1d483 commit 4914e9b

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
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.

0 commit comments

Comments
 (0)