1. Go to this page and download the library: Download hellosign/hellosign-php-sdk 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/ */
hellosign / hellosign-php-sdk example snippets
$client = new HelloSign\Client($apikey);
$client = new HelloSign\Client($email_address, $password);
$client = new HelloSign\Client($oauth_token); //instance of HelloSign\OAuthToken
$account = $client->getAccount();
$signature_request->title;
$signature_request->toArray();
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle('NDA with Acme Co.');
$request->setSubject('The NDA we talked about');
$request->setMessage('Please sign this NDA and let\'s discuss.');
$request->addSigner('[email protected]', 'Jack');
$request->addSigner('[email protected]', 'Jill');
$request->addCC('[email protected]');
$request->addFile('nda.pdf'); //Adding file from local
$response = $client->sendSignatureRequest($request);
$request = new HelloSign\TemplateSignatureRequest;
$request->enableTestMode();
$request->setTemplateId($template->getId());
$request->setSubject('Purchase Order');
$request->setMessage('Glad we could come to an agreement.');
$request->setSigner('Client', '[email protected]', 'George');
$request->setCC('Accounting', '[email protected]');
$request->setCustomFieldValue('Cost', '$20,000');
$response = $client->sendTemplateSignatureRequest($request);
$response = $client->getSignatureRequest($signature_request_id);
if ($response->isComplete()) {
echo 'All signers have signed this request.';
} else {
foreach ($response->getSignatures() as $signature) {
echo $signature->getStatusCode() . "\n";
}
}
// Create the SignatureRequest or TemplateSignatureRequest object
$request = ...
// Turn it into an embedded request
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
// Send it to HelloSign
$response = $client->createEmbeddedSignatureRequest($embedded_request);
// Grab the signature ID for the signature page that will be embedded in the
// page (for the demo, we'll just use the first one)
$signatures = $response->getSignatures();
$signature_id = $signatures[0]->getId();
// Retrieve the URL to sign the document
$response = $client->getEmbeddedSignUrl($signature_id);
// Store it to use with the embedded.js HelloSign.open() call
$sign_url = $response->getSignUrl();
$draft = new HelloSign\UnclaimedDraft($request, $client_id);
// optionally change it to a self-signing draft with $draft->setType("send_document");
$response = $client->createUnclaimedDraft($draft);
// Store it to use with the embedded.js HelloSign.open() call
$sign_url = $response->getClaimUrl();
// If the account does not exist
if !($client->isAccountValid($email)) {
// Create new account
$account = $client->createAccount(
new HelloSign\Account($email),
$client_id,
$client_secret
);
// Get OAuth token
$token = $account->getOAuthData();
} else {
// Create the OAuthTokenRequest object
$oauth_request = new HelloSign\OAuthTokenRequest(array(
'code' => $code,
'state' => $state,
'client_id' => $client_id,
'client_secret' => $client_secret
));
// Request OAuth token for the first time
$token = $client->requestOAuthToken($oauth_request);
}
// Export token to array, store it to use later
$hellosign_oauth = $token->toArray();
// Populate token from array
$token = new HelloSign\OAuthToken($hellosign_oauth);
// Refresh token if it expired
$client->refreshOAuthToken($token);
// Provide the user's OAuth access token to the client
$client = new HelloSign\Client($token);