Skip to content

Commit 9b512e1

Browse files
Update docs for 3.1
1 parent dc46d38 commit 9b512e1

File tree

13 files changed

+99
-43
lines changed

13 files changed

+99
-43
lines changed

.vuepress/3.1.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = [
22
{
33
title: 'Getting Started',
4-
collapsable: false,
4+
collapsable: true,
55
children: prefix('getting-started', [
66
'',
77
'license',
@@ -13,7 +13,7 @@ module.exports = [
1313
},
1414
{
1515
title: 'Exports',
16-
collapsable: false,
16+
collapsable: true,
1717
children: prefix('exports', [
1818
'',
1919
'collection',
@@ -33,7 +33,7 @@ module.exports = [
3333
},
3434
{
3535
title: 'Imports',
36-
collapsable: false,
36+
collapsable: true,
3737
children: prefix('imports', [
3838
'',
3939
'basics',

.vuepress/config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
title: 'Laravel Excel',
3-
description: 'Supercharged Excel exports in Laravel',
3+
description: 'Supercharged Excel exports and imports in Laravel',
44
ga: 'UA-775649-7',
55
serviceWorker: true,
66

@@ -12,7 +12,7 @@ module.exports = {
1212
[
1313
'link',
1414
{
15-
href: 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:100,300,400,500,600,700',
15+
href: 'https://fonts.googleapis.com/css?family=Nunito:100,300,400,500,600,700',
1616
rel: 'stylesheet',
1717
type: 'text/css',
1818
},
@@ -31,7 +31,7 @@ module.exports = {
3131
algolia: {
3232
apiKey: 'e95794f59bac5401e3930f71feb3a8e2',
3333
indexName: 'laravel_excel',
34-
algoliaOptions: { 'facetFilters': ["version:3.0"] },
34+
algoliaOptions: { 'facetFilters': ["version:3.1"] },
3535
},
3636

3737
serviceWorker: {
@@ -43,9 +43,9 @@ module.exports = {
4343
text: 'Version',
4444
link: '/',
4545
items: [
46+
{text: '3.1', link: '/3.1/'},
4647
{text: '3.0', link: '/3.0/'},
4748
{text: '2.1', link: '/2.1/'},
48-
{text: '3.1 (Unreleased)', link: '/3.1/'},
4949
]
5050
},
5151
{

.vuepress/style.styl

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body
22
background-color #f7fafc !important
3-
font-family "Source Sans Pro", -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif !important
3+
font-family "Nunito", -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif !important
44

55
.home .hero img
66
margin-bottom 0 !important
@@ -16,3 +16,9 @@ body
1616
.home .hero .action-button
1717
font-size : 1rem !important
1818
padding : 0.7rem 1.3rem !important
19+
20+
.sidebar-heading
21+
color: #2c3e50 !important
22+
23+
.sidebar-heading.open, .sidebar-heading:hover
24+
color: #4dc0b5 !important

3.1/exports/collection.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function storeExcel()
3636
}
3737
```
3838

39-
:bulb: More about storing exports can be found in the [storing exports on disk page](/3.0/exports/store.html).
39+
:bulb: More about storing exports can be found in the [storing exports on disk page](/3.1/exports/store.html).
4040

4141
### Dependency injection
4242

3.1/getting-started/README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Introduction
22

33
:rocket: Laravel Excel is intended at being Laravel-flavoured PhpSpreadsheet: a simple, but elegant wrapper around PhpSpreadsheet with the goal of simplifying
4-
exports.
4+
exports and imports.
55

66
:fire: [PhpSpreadsheet](https://phpspreadsheet.readthedocs.io/) is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc.
77

88
Laravel Excel features:
99

10-
* Easily export collections to Excel
11-
* Export queries with automatic chunking for better performance
12-
* Queue exports for better performance
13-
* Easily export Blade views to Excel
10+
* Easily export collections to Excel.
11+
* Export queries with automatic chunking for better performance.
12+
* Queue exports for better performance.
13+
* Easily export Blade views to Excel.
14+
* Easily import to collections.
15+
* Read the Excel file in chunks.
16+
* Handle the import inserts in batches.

3.1/getting-started/contributing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please read and understand the contribution guide before creating an issue or pu
88

99
- [Docs](https://laravel-excel.maatwebsite.nl)
1010
- [Issue tracker](https://github.com/Maatwebsite/Laravel-Excel/issues)
11-
- [Support](/3.0/getting-started/support.html)
11+
- [Support](/3.1/getting-started/support.html)
1212

1313
## Etiquette
1414

@@ -30,15 +30,15 @@ whether or not your feature is likely to be used by other users of the project.
3030

3131
- Check the codebase to ensure that your feature doesn't already exist.
3232
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
33-
- Use the [pull request template](https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/PULL_REQUEST_TEMPLATE.md).
33+
- Use the [pull request template](https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/.github/PULL_REQUEST_TEMPLATE.md).
3434

3535
## How to report a bug?
3636

3737
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
3838
- Check to make sure your bug report isn't already present within the project.
3939
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
4040
- Check the pull requests tab to ensure that the feature isn't already in progress.
41-
- Use the [issue template](https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md).
41+
- Use the [issue template](https://github.com/Maatwebsite/Laravel-Excel/blob/3.1/.github/ISSUE_TEMPLATE.md).
4242

4343
## Requirements
4444

3.1/getting-started/installation.md

+42-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* PHP: `^7.0`
66
* Laravel: `^5.5`
7-
* PhpSpreadsheet: `^1.2`
7+
* PhpSpreadsheet: `^1.4`
88
* PHP extension `php_zip` enabled
99
* PHP extension `php_xml` enabled
1010
* PHP extension `php_gd2` enabled
@@ -51,14 +51,15 @@ This will create a new config file named `config/excel.php`.
5151

5252
## Usage
5353

54-
Laravel Excel can be used in a various of ways. I'm sure you will find your prefered of using it. This can be either via dependency injection or if you prefer you can even use a facade.
54+
Laravel Excel can be used in a various of ways. I'm sure you will find your preferred of using it. This can be either via dependency injection or if you prefer you can even use a facade.
5555

5656
### Via dependency injection
5757

5858
You can inject the `Excel` manager class into your class, either via constructor injection or method injection in case of a controller.
5959

6060
```php
61-
use App\YourExport;
61+
use App\Exports\YourExport;
62+
use App\Imports\YourImport;
6263
use Maatwebsite\Excel\Excel;
6364

6465
class YourController
@@ -72,7 +73,12 @@ class YourController
7273

7374
public function export()
7475
{
75-
return $this->excel->download(new YourExport);
76+
return $this->excel->download(new YourExport, 'users.xlsx');
77+
}
78+
79+
public function import()
80+
{
81+
return $this->excel->import(new YourImport, 'users.xlsx');
7682
}
7783
}
7884
```
@@ -82,7 +88,7 @@ class YourController
8288
You can also use the `Maatwebsite\Excel\Exporter` to decouple more from the concrete Excel manager implementation.
8389

8490
```php
85-
use App\YourExport;
91+
use App\Exports\YourExport;
8692
use Maatwebsite\Excel\Exporter;
8793

8894
class YourController
@@ -101,19 +107,48 @@ class YourController
101107
}
102108
```
103109

110+
### Via Importer interface
111+
112+
You can also use the `Maatwebsite\Excel\Importer` to decouple more from the concrete Excel manager implementation.
113+
114+
```php
115+
use App\Imports\YourImport;
116+
use Maatwebsite\Excel\Importer;
117+
118+
class YourController
119+
{
120+
private $importer;
121+
122+
public function __construct(Importer $importer)
123+
{
124+
$this->importer = $importer;
125+
}
126+
127+
public function import()
128+
{
129+
return $this->importer->import(new YourImport, 'users.xlsx');
130+
}
131+
}
132+
```
133+
104134
### Via the Facade
105135

106136
If you prefer facades, you can you use the `Maatwebsite\Excel\Facades\Excel` facade or if you use the alias the `Excel` facade alias.
107137

108138
```php
109-
use App\YourExport;
139+
use App\Exports\YourExport;
110140
use Maatwebsite\Excel\Facades\Excel;
111141

112142
class YourController
113143
{
114144
public function export()
115145
{
116-
return Excel::download(new YourExport);
146+
return Excel::download(new YourExport, 'users.xlsx');
147+
}
148+
149+
public function import()
150+
{
151+
return Excel::import(new YourImport, 'users.xlsx');
117152
}
118153
}
119154
```

3.1/getting-started/license.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Netherlands
1010
You are free to use the software as you like. The code can be forked and modified, but the original copyright author should always be included!
1111

1212
::: warning Support
13-
We hold no liability and will provide support on a best effort basis. For more information about support please see [support](https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/support).
13+
We hold no liability and will provide support on a best effort basis. For more information about support please see [support](https://laravel-excel.maatwebsite.nl/docs/3.1/getting-started/support).
1414
:::
1515

1616
:rocket: If you use the software commercially and need support urgently, we can offer this on a commercial basis. Please contact <[email protected]> or phone +31 (0)10 744 9312.

3.1/getting-started/support.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ Versions will be supported for a limited amount of time.
1313
| Version | Laravel Version | Php Version | Support |
1414
|---- |----|----|----|
1515
| 2.1 | <=5.6 | <=7.0 | Unsupported since 15-5-2018 |
16-
| 3.0 | ^5.5 | ^7.0 | Security fixes till 01-04-2019 |
16+
| 3.0 | ^5.5 | ^7.0 | Security fixes till 31-12-2018 |
1717
| 3.1 | ^5.5 | ^7.0 | New features |
1818

1919
::: warning PHP version support
2020
Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version.
2121
:::
2222

23-
2423
## Requesting support
2524
Before you request support, please check the following:
2625
* Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.

3.1/getting-started/upgrade.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
## Upgrading to 3.1 from 3.0
66

7-
Version 3.1 is backwards compatible with 3.0.
7+
Version 3.1 is backwards compatible with 3.0. Only features were added in this release.
88

99
__Additions__
1010

1111
* Imports feature.
12+
* ChunkReading
13+
* BatchInserts
14+
* Queued imports
1215
* ToArray concern for Exports.
1316
* Custom value binders for Imports and Exports.
1417

@@ -31,3 +34,5 @@ ALL Laravel Excel 2.* methods are deprecated and will not be able to use in 3.0
3134
- Excel::load() is removed and replaced by Excel::import($yourImport)
3235
- Excel::create() is removed and replaced by Excel::download/Excel::store($yourExport)
3336
- 3.0 provides no convenience methods for styling, you are encouraged to use PhpSpreadsheets native methods.
37+
38+
You can find an example upgrade for an export here: https://github.com/Maatwebsite/Laravel-Excel/issues/1799

README.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@
22
home: true
33
heroImage: /assets/img/logo-small.png
44
actionText: Read documentation →
5-
actionLink: /3.0/
5+
actionLink: /3.1/
66
features:
7-
- title: 💪 Export collections to Excel.
8-
details: Supercharge your Laravel collections and export them directly to an Excel or CSV document. Exporting has never been so easy.
7+
- title: 💪 Export to Excel.
8+
details: Supercharge your Laravel collections or Blade views and export them directly to an Excel or CSV document. Exporting has never been so easy.
99
- title: 🚀 Supercharged exports.
1010
details: Export queries with automatic chunking for better performance. For even more superpowers, exports can also be queued.
11-
- title: 🔥 Export Blade views.
12-
details: Want to have a custom layout in your spreadsheet? Use a HTML table in a Blade view and export that to Excel.
11+
- title: 🔥 Supercharged imports.
12+
details: Import workbooks and worksheets to Eloquent models with chunk reading and batch inserts! You can also queue every chunk of a file! Your entire import will happen in the background.
1313
footer: MIT Licensed | Powered by Maatwebsite
1414
---
1515

16-
:bulb: Install the package via `composer`
16+
:bulb: Install the package via `composer`.
1717

1818
```
1919
composer require maatwebsite/excel
2020
```
2121

22-
:muscle: Create an export class
22+
:muscle: Create an export and import class.
2323

2424
```php
2525
php artisan make:export UsersExport --model=App\\User
26+
php artisan make:import UsersImport --model=App\\User
2627
```
2728

28-
:fire: Download your export
29+
:fire: Download your export and import your file.
2930

3031
```php
3132
<?php
3233

33-
use App\UsersExport;
34+
use App\Exports\UsersExport;
35+
use App\Imports\UsersImport;
3436
use Maatwebsite\Excel\Facades\Excel;
3537
use App\Http\Controllers\Controller;
3638

@@ -40,5 +42,10 @@ class UsersController extends Controller
4042
{
4143
return Excel::download(new UsersExport, 'users.xlsx');
4244
}
45+
46+
public function import()
47+
{
48+
return Excel::import(new UsersImport, 'users.xlsx');
49+
}
4350
}
4451
```

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"vuepress": "vuejs/vuepress#5084fcab63c0381ef5170a55f76e38f306dc756b"
3+
"vuepress": "^0.14"
44
},
55
"scripts": {
66
"docs:build": "vuepress build",

yarn.lock

+6-5
Original file line numberDiff line numberDiff line change
@@ -5628,7 +5628,7 @@ regexpu-core@^4.1.3, regexpu-core@^4.1.4:
56285628
unicode-match-property-ecmascript "^1.0.4"
56295629
unicode-match-property-value-ecmascript "^1.0.2"
56305630

5631-
register-service-worker@^1.4.1:
5631+
register-service-worker@^1.5.1:
56325632
version "1.5.2"
56335633
resolved "https://registry.yarnpkg.com/register-service-worker/-/register-service-worker-1.5.2.tgz#a4631896c38d6ec5597358f44988cc46a911912d"
56345634
integrity sha512-XNqSZHJsFGnvEGkg/2IrCp6G8Ya3qLj4mq0bSHil/dfdO82LOxGnMnJjAD9MYCvf/8cDCO8pL+1i65yzmP7rPQ==
@@ -6779,9 +6779,10 @@ vuepress-html-webpack-plugin@^3.2.0:
67796779
toposort "^1.0.0"
67806780
util.promisify "1.0.0"
67816781

6782-
vuepress@vuejs/vuepress#5084fcab63c0381ef5170a55f76e38f306dc756b:
6783-
version "0.13.0"
6784-
resolved "https://codeload.github.com/vuejs/vuepress/tar.gz/5084fcab63c0381ef5170a55f76e38f306dc756b"
6782+
vuepress@^0.14:
6783+
version "0.14.4"
6784+
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-0.14.4.tgz#fea77daa840b11429564bdddde3653bbbec4affb"
6785+
integrity sha512-AUZ+6wL1uXapX+I7h4EeXQ2Gcxaars7Ys5K8EUVuCgyDB0v36eoQWnoAVpNpMXL7kPCkVSq8DUtJQtOtHluSXQ==
67856786
dependencies:
67866787
"@babel/core" "7.0.0-beta.47"
67876788
"@vue/babel-preset-app" "3.0.0-beta.11"
@@ -6821,7 +6822,7 @@ vuepress@vuejs/vuepress#5084fcab63c0381ef5170a55f76e38f306dc756b:
68216822
portfinder "^1.0.13"
68226823
postcss-loader "^2.1.5"
68236824
prismjs "^1.13.0"
6824-
register-service-worker "^1.4.1"
6825+
register-service-worker "^1.5.1"
68256826
semver "^5.5.0"
68266827
stylus "^0.54.5"
68276828
stylus-loader "^3.0.2"

0 commit comments

Comments
 (0)