phpword word save as
<?php
require './modules/vendor/autoload.php';
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor(__DIR__ . '/wordfile.docx');
foreach ($tashkilot as $itemtwo) {
$replacements[] = [
'country' => $itemtwo->no,
'date' => $itemtwo->sana,
];
}
if (!file_exists(UPLOAD_PATH . '/folder/' . $nomi->chiqnm . " " . shaklqisqa($nomi->chiqsh, $nomi->chiqnm) . '.docx')) {
$templateProcessor->cloneBlock('nameblock', 0, true, false, $replacements);
$templateProcessor->saveAs(UPLOAD_PATH . '/folder/' . $nomi->chiqnm . " " . shaklqisqa($nomi->chiqsh, $nomi->chiqnm) . '.docx');
}