PHP code example of hamada-emam-tech / esign-uaepass
1. Go to this page and download the library: Download hamada-emam-tech/esign-uaepass 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/ */
hamada-emam-tech / esign-uaepass example snippets
$esign = new Esign([
'default' => 'uaepass',
'providers' => [
'uaepass' => [
'environment' => 'staging', // or 'production'
'client_id' => getenv('UAEPASS_CLIENT_ID'),
'client_secret' => getenv('UAEPASS_CLIENT_SECRET'),
'finish_callback_url' => 'https://app.example.ae/esign/uaepass/finished',
],
],
]);
use HamadaEmamTech\Esign\Envelope\{Envelope, Document, Signer, SignatureField, IdentityMethod};
// The user is logged in with UAE PASS already.
$sent = $esign->send(new Envelope(
documents: [Document::fromPath('contract.pdf')],
signers: [new Signer('Mariam', '[email protected] ', IdentityMethod::UaePass, fields: [new SignatureField(page: 1, x: 100, y: 110, width: 400, height: 150)])],
));
$contract->esign_ref = (string) $sent->ref(); // "uaepass:sp_….dc_…" — keep the full ID
return redirect($sent->signingUrls['[email protected] ']);
// GET /esign/uaepass/finished?status=finished&signer_process_id=sp_…
$result = $esign->handleWebhook([], $_SERVER['QUERY_STRING'], 'uaepass');
if ($result->isValid() && $esign->status($contract->esign_ref) === EnvelopeStatus::Signed) {
$pdf = $esign->download($contract->esign_ref); // needs the full stored ID
$esign->cancel($contract->esign_ref); // clean up the process, as UAE PASS recommends
}