1. Go to this page and download the library: Download morningtrain/penneo-api 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/ */
morningtrain / penneo-api example snippets
// Initialize the connection to the API
Penneo\SDK\ApiConnector::initialize('apiKeyHere', 'apiSecretHere', $endpoint);
// Initialize the connection to the API as customer
Penneo\SDK\ApiConnector::initialize('apiKeyHere','apiSecretHere', $endpoint, $customerId);
namespace Penneo\SDK;
// Create a new case file
$myCaseFile = new CaseFile();
$myCaseFile->setTitle('Demo case file');
CaseFile::persist($myCaseFile);
// Create a new signable document in this case file
$myDocument = new Document($myCaseFile);
$myDocument->setTitle('Demo document');
$myDocument->setPdfFile('/path/to/pdfFile');
$myDocument->makeSignable();
Document::persist($myDocument);
// Create a new signer that can sign documents in the case file
$mySigner = new Signer($myCaseFile);
$mySigner->setName('John Doe');
Signer::persist($mySigner);
// Create a new signature line on the document
$mySignatureLine = new SignatureLine($myDocument);
$mySignatureLine->setRole('MySignerRole');
SignatureLine::persist($mySignatureLine);
// Link the signer to the signature line
$mySignatureLine->setSigner($mySigner);
// Update the signing request for the new signer
$mySigningRequest = $mySigner->getSigningRequest();
$mySigningRequest->setSuccessUrl('http://go/here/on/success');
$mySigningRequest->setFailUrl('http://go/here/on/failure');
SigningRequest::persist($mySigningRequest);
// "Package" the case file for "sending".
$myCaseFile->send();
// And finally, print out the link leading to the signing portal.
// The signer uses this link to sign the document.
print('<a href="'.$mySigningRequest->getLink().'">Sign now</a>');
namespace Penneo\SDK;
// Create a new validation
$myValidation = new Validation();
$myValidation->setTitle('My new validation');
$myValidation->setName('John Doe');
Validation::persist($myValidation);
// Output the validation link.
print('<a href="'.$myValidation->getLink().'">Validate now</a>');