Skip to content

Commit 4358153

Browse files
wip
1 parent 58e5b43 commit 4358153

1 file changed

Lines changed: 379 additions & 0 deletions

File tree

config/excel.php

Lines changed: 379 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,379 @@
1+
<?php
2+
3+
use Maatwebsite\Excel\Excel;
4+
5+
return [
6+
'exports' => [
7+
8+
/*
9+
|--------------------------------------------------------------------------
10+
| Chunk size
11+
|--------------------------------------------------------------------------
12+
|
13+
| When using FromQuery, the query is automatically chunked.
14+
| Here you can specify how big the chunk should be.
15+
|
16+
*/
17+
'chunk_size' => 1000,
18+
19+
/*
20+
|--------------------------------------------------------------------------
21+
| Pre-calculate formulas during export
22+
|--------------------------------------------------------------------------
23+
*/
24+
'pre_calculate_formulas' => false,
25+
26+
/*
27+
|--------------------------------------------------------------------------
28+
| Enable strict null comparison
29+
|--------------------------------------------------------------------------
30+
|
31+
| When enabling strict null comparison empty cells ('') will
32+
| be added to the sheet.
33+
*/
34+
'strict_null_comparison' => false,
35+
36+
/*
37+
|--------------------------------------------------------------------------
38+
| CSV Settings
39+
|--------------------------------------------------------------------------
40+
|
41+
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
42+
|
43+
*/
44+
'csv' => [
45+
'delimiter' => ',',
46+
'enclosure' => '"',
47+
'line_ending' => PHP_EOL,
48+
'use_bom' => false,
49+
'include_separator_line' => false,
50+
'excel_compatibility' => false,
51+
'output_encoding' => '',
52+
'test_auto_detect' => true,
53+
],
54+
55+
/*
56+
|--------------------------------------------------------------------------
57+
| Worksheet properties
58+
|--------------------------------------------------------------------------
59+
|
60+
| Configure e.g. default title, creator, subject,...
61+
|
62+
*/
63+
'properties' => [
64+
'creator' => '',
65+
'lastModifiedBy' => '',
66+
'title' => '',
67+
'description' => '',
68+
'subject' => '',
69+
'keywords' => '',
70+
'category' => '',
71+
'manager' => '',
72+
'company' => '',
73+
],
74+
],
75+
76+
'imports' => [
77+
78+
/*
79+
|--------------------------------------------------------------------------
80+
| Read Only
81+
|--------------------------------------------------------------------------
82+
|
83+
| When dealing with imports, you might only be interested in the
84+
| data that the sheet exists. By default we ignore all styles,
85+
| however if you want to do some logic based on style data
86+
| you can enable it by setting read_only to false.
87+
|
88+
*/
89+
'read_only' => true,
90+
91+
/*
92+
|--------------------------------------------------------------------------
93+
| Ignore Empty
94+
|--------------------------------------------------------------------------
95+
|
96+
| When dealing with imports, you might be interested in ignoring
97+
| rows that have null values or empty strings. By default rows
98+
| containing empty strings or empty values are not ignored but can be
99+
| ignored by enabling the setting ignore_empty to true.
100+
|
101+
*/
102+
'ignore_empty' => false,
103+
104+
/*
105+
|--------------------------------------------------------------------------
106+
| Heading Row Formatter
107+
|--------------------------------------------------------------------------
108+
|
109+
| Configure the heading row formatter.
110+
| Available options: none|slug|custom
111+
|
112+
*/
113+
'heading_row' => [
114+
'formatter' => 'slug',
115+
],
116+
117+
/*
118+
|--------------------------------------------------------------------------
119+
| CSV Settings
120+
|--------------------------------------------------------------------------
121+
|
122+
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
123+
|
124+
*/
125+
'csv' => [
126+
'delimiter' => null,
127+
'enclosure' => '"',
128+
'escape_character' => '\\',
129+
'contiguous' => false,
130+
'input_encoding' => 'UTF-8',
131+
],
132+
133+
/*
134+
|--------------------------------------------------------------------------
135+
| Worksheet properties
136+
|--------------------------------------------------------------------------
137+
|
138+
| Configure e.g. default title, creator, subject,...
139+
|
140+
*/
141+
'properties' => [
142+
'creator' => '',
143+
'lastModifiedBy' => '',
144+
'title' => '',
145+
'description' => '',
146+
'subject' => '',
147+
'keywords' => '',
148+
'category' => '',
149+
'manager' => '',
150+
'company' => '',
151+
],
152+
153+
/*
154+
|--------------------------------------------------------------------------
155+
| Cell Middleware
156+
|--------------------------------------------------------------------------
157+
|
158+
| Configure middleware that is executed on getting a cell value
159+
|
160+
*/
161+
'cells' => [
162+
'middleware' => [
163+
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
164+
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
165+
],
166+
],
167+
168+
],
169+
170+
/*
171+
|--------------------------------------------------------------------------
172+
| Extension detector
173+
|--------------------------------------------------------------------------
174+
|
175+
| Configure here which writer/reader type should be used when the package
176+
| needs to guess the correct type based on the extension alone.
177+
|
178+
*/
179+
'extension_detector' => [
180+
'xlsx' => Excel::XLSX,
181+
'xlsm' => Excel::XLSX,
182+
'xltx' => Excel::XLSX,
183+
'xltm' => Excel::XLSX,
184+
'xls' => Excel::XLS,
185+
'xlt' => Excel::XLS,
186+
'ods' => Excel::ODS,
187+
'ots' => Excel::ODS,
188+
'slk' => Excel::SLK,
189+
'xml' => Excel::XML,
190+
'gnumeric' => Excel::GNUMERIC,
191+
'htm' => Excel::HTML,
192+
'html' => Excel::HTML,
193+
'csv' => Excel::CSV,
194+
'tsv' => Excel::TSV,
195+
196+
/*
197+
|--------------------------------------------------------------------------
198+
| PDF Extension
199+
|--------------------------------------------------------------------------
200+
|
201+
| Configure here which Pdf driver should be used by default.
202+
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
203+
|
204+
*/
205+
'pdf' => Excel::DOMPDF,
206+
],
207+
208+
/*
209+
|--------------------------------------------------------------------------
210+
| Value Binder
211+
|--------------------------------------------------------------------------
212+
|
213+
| PhpSpreadsheet offers a way to hook into the process of a value being
214+
| written to a cell. In there some assumptions are made on how the
215+
| value should be formatted. If you want to change those defaults,
216+
| you can implement your own default value binder.
217+
|
218+
| Possible value binders:
219+
|
220+
| [x] Maatwebsite\Excel\DefaultValueBinder::class
221+
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
222+
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
223+
|
224+
*/
225+
'value_binder' => [
226+
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
227+
],
228+
229+
'cache' => [
230+
/*
231+
|--------------------------------------------------------------------------
232+
| Default cell caching driver
233+
|--------------------------------------------------------------------------
234+
|
235+
| By default PhpSpreadsheet keeps all cell values in memory, however when
236+
| dealing with large files, this might result into memory issues. If you
237+
| want to mitigate that, you can configure a cell caching driver here.
238+
| When using the illuminate driver, it will store each value in the
239+
| cache store. This can slow down the process, because it needs to
240+
| store each value. You can use the "batch" store if you want to
241+
| only persist to the store when the memory limit is reached.
242+
|
243+
| Drivers: memory|illuminate|batch
244+
|
245+
*/
246+
'driver' => 'memory',
247+
248+
/*
249+
|--------------------------------------------------------------------------
250+
| Batch memory caching
251+
|--------------------------------------------------------------------------
252+
|
253+
| When dealing with the "batch" caching driver, it will only
254+
| persist to the store when the memory limit is reached.
255+
| Here you can tweak the memory limit to your liking.
256+
|
257+
*/
258+
'batch' => [
259+
'memory_limit' => 60000,
260+
],
261+
262+
/*
263+
|--------------------------------------------------------------------------
264+
| Illuminate cache
265+
|--------------------------------------------------------------------------
266+
|
267+
| When using the "illuminate" caching driver, it will automatically use
268+
| your default cache store. However if you prefer to have the cell
269+
| cache on a separate store, you can configure the store name here.
270+
| You can use any store defined in your cache config. When leaving
271+
| at "null" it will use the default store.
272+
|
273+
*/
274+
'illuminate' => [
275+
'store' => null,
276+
],
277+
278+
/*
279+
|--------------------------------------------------------------------------
280+
| Cache Time-to-live (TTL)
281+
|--------------------------------------------------------------------------
282+
|
283+
| The TTL of items written to cache. If you want to keep the items cached
284+
| indefinitely, set this to null. Otherwise, set a number of seconds,
285+
| a \DateInterval, or a callable.
286+
|
287+
| Allowable types: callable|\DateInterval|int|null
288+
|
289+
*/
290+
'default_ttl' => 10800,
291+
],
292+
293+
/*
294+
|--------------------------------------------------------------------------
295+
| Transaction Handler
296+
|--------------------------------------------------------------------------
297+
|
298+
| By default the import is wrapped in a transaction. This is useful
299+
| for when an import may fail and you want to retry it. With the
300+
| transactions, the previous import gets rolled-back.
301+
|
302+
| You can disable the transaction handler by setting this to null.
303+
| Or you can choose a custom made transaction handler here.
304+
|
305+
| Supported handlers: null|db
306+
|
307+
*/
308+
'transactions' => [
309+
'handler' => 'db',
310+
'db' => [
311+
'connection' => null,
312+
],
313+
],
314+
315+
'temporary_files' => [
316+
317+
/*
318+
|--------------------------------------------------------------------------
319+
| Local Temporary Path
320+
|--------------------------------------------------------------------------
321+
|
322+
| When exporting and importing files, we use a temporary file, before
323+
| storing reading or downloading. Here you can customize that path.
324+
| permissions is an array with the permission flags for the directory (dir)
325+
| and the create file (file).
326+
|
327+
*/
328+
'local_path' => storage_path('framework/cache/laravel-excel'),
329+
330+
/*
331+
|--------------------------------------------------------------------------
332+
| Local Temporary Path Permissions
333+
|--------------------------------------------------------------------------
334+
|
335+
| Permissions is an array with the permission flags for the directory (dir)
336+
| and the create file (file).
337+
| If omitted the default permissions of the filesystem will be used.
338+
|
339+
*/
340+
'local_permissions' => [
341+
// 'dir' => 0755,
342+
// 'file' => 0644,
343+
],
344+
345+
/*
346+
|--------------------------------------------------------------------------
347+
| Remote Temporary Disk
348+
|--------------------------------------------------------------------------
349+
|
350+
| When dealing with a multi server setup with queues in which you
351+
| cannot rely on having a shared local temporary path, you might
352+
| want to store the temporary file on a shared disk. During the
353+
| queue executing, we'll retrieve the temporary file from that
354+
| location instead. When left to null, it will always use
355+
| the local path. This setting only has effect when using
356+
| in conjunction with queued imports and exports.
357+
|
358+
*/
359+
'remote_disk' => 's3private',
360+
'remote_prefix' => 'laravel-excel-tmp',
361+
362+
/*
363+
|--------------------------------------------------------------------------
364+
| Force Resync
365+
|--------------------------------------------------------------------------
366+
|
367+
| When dealing with a multi server setup as above, it's possible
368+
| for the clean up that occurs after entire queue has been run to only
369+
| cleanup the server that the last AfterImportJob runs on. The rest of the server
370+
| would still have the local temporary file stored on it. In this case your
371+
| local storage limits can be exceeded and future imports won't be processed.
372+
| To mitigate this you can set this config value to be true, so that after every
373+
| queued chunk is processed the local temporary file is deleted on the server that
374+
| processed it.
375+
|
376+
*/
377+
'force_resync_remote' => null,
378+
],
379+
];

0 commit comments

Comments
 (0)