PHP code example of vivait / docbuild-php

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

    

vivait / docbuild-php example snippets


// Instantiate your adapter
$client = new MyAdapter();

$docBuild = new DocBuild($clientId, $clientSecret, $client);

$docBuild->createDocument('ADocument', 'docx', '/path/to/file.docx');

$docs = $docBuild->getDocuments();

$docBuild->convertToPdf('documentid', 'http://mycallback.url/api');


$docBuild = new DocBuild(
    $clientId, 
    $clientSecret, 
    GuzzleAdapter::createWithConfig([]), 
    $options, 
    null, 
    new ArrayCache()
);

$docBuild->setOptions(
    [
        'token_refresh' => false, // Default: true
    ]
);

try {
	$docs = $docBuild->getDocuments();
} catch (TokenExpiredException $e) {
	// Have another go
}

composer