PHP code example of garethhallnz / pandadoc

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

    

garethhallnz / pandadoc example snippets



    $accessToken = 'your-access-token';
    
    $documents = new Documents($accessToken);
    
    // List all the documents.
    $data = $documents->list();
    
    // Search for a document.
    $filter = [
        'q' => 'Search string here'
    ];
    
    $data = $documents->list($filter);
    
    // Show document details.
    $data = $documents->details('documentID');
    
    // Show document state.
    $data = $documents->status('documentID');
    
    // Download a document
    $data = $documents->download('documentID', "destination-path");


    $accessToken = 'your-access-token';
    
    $templates = new Templates($accessToken);
    
    // List all the templates.
    $data = $templates->list();
    
    // Show template details.
    $data =$templates->details('templateID');


    $accessToken = 'your-access-token';
    
    // Refresh access token
    $auth = new Auth();
    $client_id = 'your-client-id';
    $client_secret = 'your-secret';
    $refresh_token = 'your-refresh-token';

    // Show new tokens.
    $data = $auth->refreshAccessToken($client_id, $client_secret, $refresh_token);