Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.
/ clicksign-php Public archive

DESCONTINUADA: Biblioteca PHP da Clicksign versão Classic

Notifications You must be signed in to change notification settings

clicksign/clicksign-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clicksign PHP Client

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)

About

DESCONTINUADA: Biblioteca PHP da Clicksign versão Classic

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages