V1.0 2019-08-01 11:56 UTC

This package is not auto-updated.

Last update: 2024-09-15 22:47:22 UTC


README

Build Status License

这个库提供了对PandaDoc REST API的方便包装函数。API在此处有文档:https://developers.pandadoc.com/

要求

安装

依赖项由 Composer 管理。安装Composer后,从库根目录运行以下命令

composer install --no-dev --ignore-platform-reqs

或者使用phpunit进行安装

composer install

使用文档

<?php
    require 'vendor/autoload.php';
    
    $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");

使用模板

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

刷新访问令牌

<?php
    require 'vendor/autoload.php';
    
    $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);