clicksign / clicksign-php
PHP client to consume Clicksign JSON API
Installs: 64 019
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 21
Forks: 8
Open Issues: 0
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is not auto-updated.
Last update: 2020-01-28 11:22:09 UTC
README
This is the PHP wrapper for Clicksign REST API.
How to use
Installing with composer
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:
Installing without composer
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
Documents Services
List all documents:
$docs = $client->documents->all(); foreach ($docs as $d) { print $d->document->key; }
Upload a document:
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.
Retrieve a document:
$doc = $client->documents->find("DOCUMENT_KEY"); print $doc->document->original_name;
Download a document:
$file = $client->documents->download("DOCUMENT_KEY");
Create a signature list:
$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.
Resend a document:
$email = "jose.silva@example.com"; $message = "This is a reminder. Please sign the document"; $client->documents->resend("DOCUMENT_KEY", $email, $message);
Cancel document:
$client->documents->cancel("DOCUMENT_KEY");
Hooks Services
Create a hook:
$hook = $client->hooks->create("DOCUMENT_KEY", "http://example.com/clicksign/callback.php");
List all document's hooks:
$hooks = $client->hooks->all("DOCUMENT_KEY");
Delete a hook:
$client->hooks->delete("DOCUMENT_KEY", 2163);
Batches Services
Create a batch:
$documentKeys = array("DOCUMENT_KEY_1", "DOCUMENT_KEY_2", "DOCUMENT_KEY_3"); $batch = $client->batches->create($documentKeys);
List all batches:
$batches = $client->batches->all();
Delete a batch:
$client->batches->delete("DOCUMENT_BATCH_KEY");
Dev notes
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)