PHP code example of mbence / opentbs-bundle

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

    

mbence / opentbs-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new MBence\OpenTBSBundle\OpenTBSBundle(),
    );
}

    // get the service
    $TBS = $this->get('opentbs');
    // load your template
    $TBS->LoadTemplate('template.docx');
    // replace variables
    $TBS->MergeField('client', array('name' => 'Ford Prefect'));
    // send the file
    $TBS->Show(OPENTBS_DOWNLOAD, 'file_name.docx');