Skip to content

fabioperrella/clicksign-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clicksign PHP Client

This is the PHP wrapper for Clicksign REST API.

Example of usage

Create a file named composer.json with the content below:

{
    "require": {
        "clicksign/clicksign-php": "*"
    }
}

Then, create a file, for example sample.php, to load and use the library:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

use Clicksign\Client;

date_default_timezone_set('America/Bahia');

$client = new Client();
$client->setAccessToken("ACCESS_TOKEN"); //must be a valid token (ask Clicksign support team for a a valid token)
$client->setUrl("https://api.clicksign-demo.com/");
$docs = $client->documents->all();
print_r($docs);
?>

Then run php sample.php

A more advanced sample 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.

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);

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");

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%