PHP code example of dropbox / sign

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

    

dropbox / sign example snippets




ig = Dropbox\Sign\Configuration::getDefaultConfiguration();

// Configure HTTP basic authorization: api_key
$config->setUsername("YOUR_API_KEY");

// or, configure Bearer (JWT) authorization: oauth2
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$accountApi = new Dropbox\Sign\Api\AccountApi($config);

$data = new Dropbox\Sign\Model\AccountCreateRequest();
$data->setEmailAddress("[email protected]");

try {
    $result = $accountApi->accountCreate($data);
    print_r($result);
} catch (Dropbox\Sign\ApiException $e) {
    $error = $e->getResponseObject();
    echo "Exception when calling Dropbox Sign API: "
        . print_r($error->getError());
}




ig = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");

$api = new Dropbox\Sign\Api\SignatureRequestApi($config);

$data = Dropbox\Sign\Model\SignatureRequestSendRequest::init([
    "title"   => "NDA with Acme Co.",
    "signers" => [
        [
            "email_address" => "[email protected]",
            "name"          => "Jack",
            "order"         => 0,
        ],
        [
            "email_address" => "[email protected]",
            "name"          => "Jill",
            "order"         => 1,
        ],
    ],
    "files"    => [
        new SplFileObject("/absolute/path/to/file.pdf"),
    ],
]);

try {
    $result = $api->signatureRequestSend($data);
    print_r($result);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling Dropbox Sign API: "
        . $e->getMessage() . PHP_EOL;
}