PHP code example of hamada-emam-tech / esign-signit

1. Go to this page and download the library: Download hamada-emam-tech/esign-signit 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/ */

    

hamada-emam-tech / esign-signit example snippets


$esign = new Esign([
    'default'   => 'signit',
    'providers' => [
        'signit' => [
            'environment'    => 'production',         // or 'sandbox' (the default)
            'client_id'      => getenv('SIGNIT_CLIENT_ID'),
            'client_secret'  => getenv('SIGNIT_CLIENT_SECRET'),
            'webhook_secret' => getenv('SIGNIT_WEBHOOK_SECRET'),   // the 64-character hex key from Signit
        ],
    ],
]);

use HamadaEmamTech\Esign\Envelope\{Envelope, Document, Signer, SignatureField};

$sent = $esign->send(new Envelope(
    documents: [Document::fromPath('contract.pdf')],
    signers: [
        Signer::nafath('1012345678', 'Ahmed Ali', '[email protected]', order: 1, fields: [new SignatureField(page: 1, x: 60, y: 700)]),
        Signer::email('Sara', '[email protected]', order: 2, fields: [new SignatureField(page: 1, x: 300, y: 700)]),
    ],
    subject: 'Supply agreement',
));
$contract->esign_ref = (string) $sent->ref();       // "signit:1001"
$sent->signingUrls;                                 // email => signing link

// Webhooks, status, download and reminders: the same calls as every provider (see docs/webhooks.md)
$esign->status($ref);
$esign->details($ref)->pending();
$esign->remind($ref, '[email protected]');
$pdf = $esign->download($ref);                      // the sealed PDF, once everyone signed
$esign->cancel($ref);                               // voids the request