1. Go to this page and download the library: Download noardcode/laravel-signhost 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/ */
noardcode / laravel-signhost example snippets
use Illuminate\Support\Facades\Storage;
use Noardcode\LaravelSignhost\Enums\Language;
use Noardcode\LaravelSignhost\Facades\Signhost;
use Noardcode\LaravelSignhost\ValueObjects\Transaction as TransactionVO;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\FileUpload;
use Noardcode\LaravelSignhost\Collections\TransactionSignersCollection;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Signer;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Verifications\Scribble;
// Define your signer(s)
$signers = new TransactionSignersCollection([
new Signer(
email: '[email protected]',
verifications: [
new Scribble(
load file(s) to Signhost
$storedTransaction = Signhost::signing()->createFiles($storedTransaction);
// 3) Start the transaction – this triggers sending of the signing link
Signhost::signing()->startTransaction($storedTransaction);
use Illuminate\Support\Facades\Storage;
use Noardcode\LaravelSignhost\Enums\Language;
use Noardcode\LaravelSignhost\Facades\Signhost;
use Noardcode\LaravelSignhost\ValueObjects\Transaction as TransactionVO;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\FileUpload;
use Noardcode\LaravelSignhost\Collections\TransactionSignersCollection;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Signer;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Verifications\Scribble;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\FileEntries\FileMetaData;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\FileEntries\FileMetaData\FormSet;
// Define your signer(s)
$signers = new TransactionSignersCollection([
new Signer(
email: '[email protected]',
verifications: [
new Scribble(
',
fieldTypes: [
new FormSet\FieldType(
name: 'FirstNameInput',
formSetType: FormSetType::Signature,
location: new FormSet\Location(
search: 'FirstName: ',
occurence: 1,
)
),
new FormSet\FieldType(
name: 'Signature',
formSetType: FormSetType::Check,
location: new FormSet\Location(
search: 'Signature here: ',
occurence: 1,
)
)
]
);
// Set the formSet to use on the fileUploadVO
$fileUploadVO->setFormSet($formset);
// Specify which signer(s) should use which formSet
$signerFormSets = array_map(
fn($signer) => new FileMetaData\Signer(
id: $signer->getId(),
formSets: ['DummyFormSet']
),
$signers
);
// Set the fileMetaData to use the specified formSet
$fileUploadVO->setFileMetaData(
new FileMetaData(
displayOrder: 0,
displayName: 'My Contract',
setParaph: false,
signers: new TransactionFileMetaDataSignersCollection($signerFormSets)
)
);
// After this we can create the transaction as normal
use Illuminate\Support\Facades\Storage;
use Noardcode\LaravelSignhost\Enums\Language;
use Noardcode\LaravelSignhost\Facades\Signhost;
use Noardcode\LaravelSignhost\ValueObjects\Transaction as TransactionVO;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\FileUpload;
use Noardcode\LaravelSignhost\Collections\TransactionSignersCollection;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Signer;
// 1) After the signer completes, download the signed document(s)
Signhost::signing()->getSignedFiles($storedTransaction);
// 2) Download the signing receipt for verification
Signhost::signing()->getReceipt($storedTransaction);
use Noardcode\LaravelSignhost\Facades\Signhost;
use Noardcode\LaravelSignhost\Enums\Language;
use Noardcode\LaravelSignhost\ValueObjects\IdProof as IdProofVO;
use Noardcode\LaravelSignhost\ValueObjects\Transactions\Signer;
// 1) Create your own identifier for the signer
$identifier = 'your-own-identifier';
// 2) Redirect the user to the Signhost verification page
return Signhost::idproof()->redirectToSignhost($identifier);
use Noardcode\LaravelSignhost\Facades\Signhost;
use Noardcode\LaravelSignhost\Events\SignhostIdProofCreated;
use Noardcode\LaravelSignhost\Models\Transaction;
use Illuminate\Support\Facades\Event;
// Subscribe to the event and retrieve the dossier
Event::listen(SignhostIdProofCreated::class, function (Transaction $transaction) {
// Do your custom logic here to retrieve the dossier
YourCustomJob::dispatch($transaction);
});
use Noardcode\LaravelSignhost\Facades\Signhost;
// Retrieve dossier
Signhost::idproof()->getDossier($transactionId, $fileId);
use Noardcode\LaravelSignhost\Facades\Signhost;
// Retrieve dossier
Signhost::idproof()->getReceipt($transactionId);