function getTmpDir(): string
$tmp = ini_get('upload_tmp_dir');
if ($tmp !== False && file_exists($tmp)) {
return realpath(sys_get_temp_dir());
'path' => getTmpDir() . '/',
$fileName = 'tutorial01.xlsx';
$xlsxObject = new \Vtiful\Kernel\Excel($config);
$fileObject = $xlsxObject->fileName($fileName);
// Writing data to a file ......
$filePath = $fileObject->output();
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header('Content-Disposition: attachment;filename="' . $fileName . '"');
header('Content-Length: ' . filesize($filePath));
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate');
header('Cache-Control: max-age=0');
header('Pragma: public');
if (copy($filePath, 'php://output') === false) {