This is the PHP wrapper for Clicksign REST API.
Create a file named composer.json with the content below:
{
"require": {
"clicksign/clicksign-php": "*"
}
}
Then, create a file like example/sample1.php to load the library:
Download the code at https://github.com/clicksign/clicksign-php/archive/master.zip
Extract the code to a folder
Then, create a file like example/sample1.php to load the library:
A more complete example can be found in example/sample2.php
$docs = $client->documents->all();
foreach ($docs as $d)
{
print $d->document->key;
}
Upload only the file:
$client->documents->upload("/Users/clicksign/Documents/Filename.pdf");
It also accepts an $options
array:
$signers = array(array("email" => "jose.silva@example.com", "act" => "sign"), array("email" => "joao.souza@example.org", "act" => "witness"));
$message = "Please sign this document.";
$skipEmail = false;
$options = array("signers" => $signers, "message" => $message, "skipEmail" => $skipEmail);
$client->documents->upload("/Users/clicksign/Documents/Filename.pdf", $options);
This call will upload the file and create the signature list along with the message. If $options
array is passed, signers array inside of it is mandatory.
Attention: You must enforce use of UTF-8 or you may get server-side errors when you try to send anything but regular ASCII.
$doc = $client->documents->find("DOCUMENT_KEY");
print $doc->document->original_name;
$file = $client->documents->download("DOCUMENT_KEY");
$signers[0]["email"] = "jose.silva@example.com";
$signers[0]["act"] = "sign";
$signers[1]["email"] = "joao.souza@example.org";
$signers[1]["act"] = "witness";
$client->documents->createList("DOCUMENT_KEY", $signers);
Or:
$signers = array(array("email" => "jose.silva@example.com", "act" => "sign"), array("email" => "joao.souza@example.org", "act" => "witness"));
$client->documents->createList("DOCUMENT_KEY", $signers);
You may pass message
and skip_email
parameters:
$client->documents->createList("DOCUMENT_KEY", $signers, "Hi guys, please sign this document.", false);
Attention: You must enforce use of UTF-8 or you may get server-side errors when you try to send anything but regular ASCII.
$email = "jose.silva@example.com";
$message = "This is a reminder. Please sign the document";
$client->documents->resend("DOCUMENT_KEY", $email, $message);
$client->documents->cancel("DOCUMENT_KEY");
$hook = $client->hooks->create("DOCUMENT_KEY", "http://example.com/clicksign/callback.php");
$hooks = $client->hooks->all("DOCUMENT_KEY");
$client->hooks->delete("DOCUMENT_KEY", 2163);
$documentKeys = array("DOCUMENT_KEY_1", "DOCUMENT_KEY_2", "DOCUMENT_KEY_3");
$batch = $client->batches->create($documentKeys);
$batches = $client->batches->all();
$client->batches->delete("DOCUMENT_BATCH_KEY");
To "vendor" compose packages, run the command composer install --no-dev --no-scripts
(based on instructions in https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md)