PHP code example of ggvivar / mailmerge

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

    

ggvivar / mailmerge example snippets


return [
];


$mailmerge = new Homeful\Mailmerge();
bash
php artisan vendor:publish --tag="mailmerge-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="mailmerge-config"
bash
php artisan vendor:publish --tag="mailmerge-views"

echo $mailmerge->generateDocument(
    $filePath, //file path in storage
    $arrInput, //Json Input
    $fileName, //optional
    "local" , //optional if file is in local - default public
    $download //optional boolean true need file download response 
); //URL response

echo $mailmerge->downloadDocument(
    $filePath, //file path in storage
    $filename, //optional  
    "local" //optional if file is in local - default public
    )