laulamanapps / document-signer-validsign
ValidSign implementation of the document signer SDK.
Package info
github.com/LauLamanApps/document-signer-validsign
pkg:composer/laulamanapps/document-signer-validsign
Requires
- php: ^8.5
- guzzlehttp/guzzle: ^7.8
- laulamanapps/document-signer-sdk: ^1.0
Requires (Dev)
- phpunit/phpunit: ^11.0
README
ValidSign implementation of the
SignatureProvider contract from
laulamanapps/document-signer-sdk.
Install
composer require laulamanapps/document-signer-validsign
Quick start
use LauLamanApps\DocumentSigner\Sdk\Document\Document; use LauLamanApps\DocumentSigner\Sdk\Envelope\Envelope; use LauLamanApps\DocumentSigner\Sdk\Signer\Signer; use LauLamanApps\DocumentSigner\ValidSign\ValidSignConfig; use LauLamanApps\DocumentSigner\ValidSign\ValidSignProvider; $provider = new ValidSignProvider(new ValidSignConfig( apiKey: getenv('VALIDSIGN_API_KEY'), baseUrl: 'https://my.validsign.nl/api', )); $receipt = $provider->send(new Envelope( name: 'NDA', documents: [new Document( id: 'nda', name: 'NDA', html: '<p>{[signature:counterparty:sig]} on {[date:counterparty:signdate]}</p>', )], signers: [new Signer(key: 'counterparty', name: 'Jane Doe', email: 'jane@example.com')], emailSubject: 'Please sign the NDA', )); echo $receipt->provider; // "validsign" (ValidSignProvider::NAME) echo $receipt->providerEnvelopeId; // ValidSign packageId
What it does
For every document in the envelope, this package:
- Parses
{[type:signer:name]}placeholders out of the HTML. - Substitutes each one with a hidden ValidSign text-tag
— e.g.
{{esl_sig:Signer1:Signature:size(200,50)}}. The SDK translates the arbitrary signer key from the envelope (counterparty,customer, …) into ValidSign's positionalSigner1,Signer2, … tokens. - Renders the HTML to PDF via the SDK's
PdfRenderer(Browsershot by default). - POSTs the PDFs + a
packageJSON toPOST /packageswithdocuments[].extract = true. ValidSign discovers the text-tags in the PDF server-side and places the matching fields on the corresponding signer — no per-field configuration in the API payload. - Returns an
EnvelopeReceiptcontaining the ValidSign package id and a normalisedEnvelopeStatus.
Downloads
Both downloadSigned() and downloadAudit() write to a temp file and hand you
an \SplFileInfo — check the extension:
$archive = $provider->downloadSigned($packageId); // $archive->getExtension() === 'zip' // A ZIP with one signed PDF per document in the package (endpoint: /packages/{id}/documents/zip) $audit = $provider->downloadAudit($packageId); // $audit->getExtension() === 'pdf' // The Evidence Summary Report (endpoint: /packages/{id}/evidence/summary)
Callers own the file lifecycle — copy or @unlink() when done.
Field mapping
Each SDK FieldType becomes a ValidSign text-tag with a default size. The
optional * prefix marks a field as required — signatures and initials are
implicitly required per ValidSign, so no prefix is applied for them.
SDK FieldType |
Emitted text-tag |
|---|---|
Signature |
{{esl_<name>:SignerN:Signature:size(200,50)}} |
Initials |
{{esl_<name>:SignerN:initials:size(100,30)}} |
Text |
{{*esl_<name>:SignerN:TextField:size(200,20)}} |
Date |
{{esl_<name>:SignerN:SigningDate:size(120,20)}} |
Checkbox |
{{*esl_<name>:SignerN:Checkbox:size(20,20)}} |
<name> is your placeholder's field name; SignerN is the signer's positional
index in Envelope::$signers (1-based).
Requirements
- PHP 8.5
laulamanapps/documentsigner-sdk- A ValidSign tenant + API key
- Node.js + Puppeteer (for the default Browsershot renderer)
Documentation
The full provider guide — credentials, endpoint mapping, status mapping, sequential signing, injecting a custom HTTP client, troubleshooting — lives in the SDK's docs: