PHP code example of la-souris / document-signer-sdk

1. Go to this page and download the library: Download la-souris/document-signer-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/ */

    

la-souris / document-signer-sdk example snippets


$envelope = Envelope::builder()
    ->name('NDA 2026-06')
    ->emailSubject('Please sign the NDA')
    ->emailMessage('Hi Jane, please sign at your convenience.')
    ->addDocument($document)
    ->addSigner($signer)
    ->signingOrder(SigningOrder::Parallel)
    ->withMetadata('contract_id', 42)
    ->build();

Envelope::builder()
    ->name('NDA')
    ->emailSubject('Please sign')
    // Pre-built object:
    ->addDocument(new Document(id: 'nda', name: 'NDA', html: $html))
    // Inline named args:
    ->addSigner(key: 'counterparty', name: 'Jane Doe', email: '[email protected]')
    ->build();

new Document(
    id:   'nda',
    name: 'NDA',
    html: '<h1>NDA</h1>...',
    headerHtml: '<div class="brand">Acme Legal</div>',
    footerHtml: '<div>Confidential</div>',
    headerPlacement: HeaderPlacement::FirstPage,   // or ::AllPages
    footerPlacement: FooterPlacement::AllPages,
);

use LaSouris\DocumentSigner\Sdk\Document\Document;
use LaSouris\DocumentSigner\Sdk\Envelope\Envelope;
use LaSouris\DocumentSigner\Sdk\Signer\Signer;
use LaSouris\DocumentSigner\Sdk\Signer\SigningOrder;
use LaSouris\DocumentSigner\ValidSign\ValidSignConfig;
use LaSouris\DocumentSigner\ValidSign\ValidSignProvider;

$envelope = new Envelope(
    name:         'NDA 2026-06',
    documents:    [
        new Document(
            id:   'nda',
            name: 'Non-disclosure agreement',
            html: '<h1>NDA</h1><p>Signed by {[text:counterparty:fullname]}</p>'
                . '<p>{[signature:counterparty:sig]} on {[date:counterparty:signdate]}</p>',
        ),
    ],
    signers:      [
        new Signer(key: 'counterparty', name: 'Jane Doe', email: '[email protected]'),
    ],
    emailSubject: 'Please sign the NDA',
    emailMessage: 'Hi Jane, please sign at your convenience.',
    signingOrder: SigningOrder::Parallel,
);

$provider = new ValidSignProvider(
    new ValidSignConfig(apiKey: getenv('VALIDSIGN_API_KEY')),
);

$receipt = $provider->send($envelope);
// $receipt->providerEnvelopeId is now the ValidSign package id.