PHP code example of nguyenhiep / docxfindandreplace
1. Go to this page and download the library: Download nguyenhiep/docxfindandreplace library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nguyenhiep / docxfindandreplace example snippets
php
\Nguyenhiep\DocxFindAndReplace\Docx::create(__DIR__ . "/template.docx")->replace(
[
"firstname" => "nguyen",
"lastname" => "hiep",
"/[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+.[a-zA-Z]{2,4}/" => "[email protected]"
]
)->save(__DIR__ . '/newfile.docx');