PHP code example of direct808 / docxerator

1. Go to this page and download the library: Download direct808/docxerator 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/ */

    

direct808 / docxerator example snippets


// somewhere early in your project's loading, d

// reference the Docxerator namespace
use Direct808\Docxerator\Docxerator;

// instantiate and use the Docxerator class
$docxerator = new Docxerator();

// open docx template file (contains the label #MARK#)
$docxerator->open('./you_docx_document.docx');

// Replace the label
$docxerator->replace('MARK', 'Your replaced content');

// Save the processing document
$processingDocumentPath = $docxerator->save();

$docxerator = new Docxerator();

// Docxerator will processing labels of the format {MARK}
$docxerator->setMarkPattern('/\{(\w+)\}/i');

$docxerator->open('./you_docx_document.docx');

$processingDocumentPath = $docxerator->save();