Skip to content

Commit db22fe9

Browse files
Develop (#412)
* chore: update local development readme and db seeder (#404) * chore: update development readme * chore: add about and faq pages to db seeder * chore: readme tiny change * hotfix: filter out projects with invalid dates (#406) * fix: apply HasValidDates scope to Project and BCRProject queries * chore: rename for readability fix * fix email * add cover url for cover photo in article * fix cs-fixer * add fallback * wip * wip --------- Co-authored-by: ancarofl <35558437+ancarofl@users.noreply.github.com>
1 parent ec00dc1 commit db22fe9

1 file changed

Lines changed: 381 additions & 0 deletions

File tree

config/excel.php

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

0 commit comments

Comments
 (0)