1. Go to this page and download the library: Download ferreiramg/clicksign 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/ */
ferreiramg / clicksign example snippets
use Clicksign\Support\ClicksignWorkflow;
use Clicksign\Facades\Clicksign;
// Instanciar o workflow helper
$workflow = new ClicksignWorkflow(app(ClicksignClientInterface::class));
// Dados do signatário
$signers = [
[
'name' => 'João Silva',
'email' => '[email protected]',
'birthday' => '1990-01-01',
'has_documentation' => true
]
];
// Criar workflow completo
$result = $workflow->createSignatureWorkflow(
envelopeName: 'Contrato de Prestação de Serviços',
filename: 'contrato.pdf',
contentBase64: base64_encode(file_get_contents('path/to/contrato.pdf')),
signers: $signers,
envelopeOptions: [
'locale' => 'pt-BR',
'auto_close' => true,
'remind_interval' => 3,
'deadline_at' => '2025-12-31T23:59:59.000-03:00'
]
);
$envelopeId = $result['envelope']['data']['id'];
// Ativar o processo de assinatura
$workflow->startSignatureProcess($envelopeId);
// Enviar notificação
$workflow->sendNotification($envelopeId, 'Por favor, assine o documento.');
// Eventos de um documento específico
$documentEvents = Clicksign::getDocumentEvents($envelopeId, $documentId);
// Eventos de todos os documentos do envelope
$envelopeEvents = Clicksign::getEnvelopeEvents($envelopeId);
$client = new ClicksignClient(
accessToken: 'your_token',
baseUrl: 'https://sandbox.clicksign.com/api/v3'
);
use Clicksign\Exceptions\{
AuthenticationException,
DocumentNotFoundException,
ValidationException,
ClicksignException
};
try {
$response = Clicksign::createEnvelope($envelope->toArray());
} catch (AuthenticationException $e) {
// Token inválido
} catch (ValidationException $e) {
// Dados inválidos
$errors = $e->getErrors();
} catch (DocumentNotFoundException $e) {
// Documento não encontrado
} catch (ClicksignException $e) {
// Outros erros da API
}