PHP code example of pierrebelinfork / universignfork
1. Go to this page and download the library: Download pierrebelinfork/universignfork 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/ */
pierrebelinfork / universignfork example snippets
$ACCOUNT_USER_MAIL = '[email protected]';
$ACCOUNT_USER_PASSWORD = 'xxxxxxxxx';
$UNIVERSIGN_PROFILE = 'default'; // you don't have to change this one, if you want to, read the manual
$document = new TransactionDocument();
$document
->setContent(file_get_contents('path/to/file/file.pdf'))
->setName('Document name');
$signatureField1 = new SignatureField();
$signatureField1->setPage(1)
->setX(50)
->setY(100);
$signer = new TransactionSigner();
$signer
->setFirstname('Pierre')
->setLastname('Belin')
->setEmailAddress('[email protected]')
->setPhoneNum('0606060606')
->setBirthDate('19900131T00:00:00') // This format is needed yyyymmddT00:00:00 as string for 31/01/1990
->setSuccessURL('https://www.universign.eu/fr/sign/success/')
->setCancelURL('https://www.universign.eu/fr/sign/cancel/')
->setFailURL('https://www.universign.eu/fr/sign/failed/')
->addSignatureField($signatureField1); // you can add multiples times ->addSignatureField($signatureField2) etc...
$request = new TransactionRequest();
$request
->addSigner($signer) // you can add multiples times ->addSignatureField($signer2) etc...
->addDocument($document) // you can add multiples times ->addDocument($document2) etc...
->setProfile($UNIVERSIGN_PROFILE)
->setCustomId(uniqid()) // create your own ID to make easier to get later
->setMustContactFirstSigner(false)
->setFinalDocSent(true)
->setDescription("This is my description")
->setCertificateType(TransactionRequestCertificate::CERTIFICATE_CERTIFIED)
->setLanguage(TransactionRequestLanguage::FRENCH)
->setHandwrittenSignature(true)
->setChainingMode(TransactionRequestChainingMode::CHAINING_MODE_EMAIL);
$requester = new Requester($ACCOUNT_USER_MAIL, $ACCOUNT_USER_PASSWORD, false);
$requester->requestTransaction($request);