1. Go to this page and download the library: Download oi-lab/oi-laravel-sign 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/ */
use OiLab\OiLaravelSign\Concerns\HasSignatureRequests;
use OiLab\OiLaravelSign\Contracts\Signable;
use OiLab\OiLaravelSign\Data\BrandingData;
use OiLab\OiLaravelSign\Data\SignableAttachmentData;
class Quote extends Model implements Signable
{
use HasSignatureRequests;
public function signableTitle(): string { return "Quote {$this->number}"; }
public function signablePdf(): string { return app(QuotePdf::class)->render($this); }
public function signableAttachments(): array
{
return [new SignableAttachmentData(name: 'Terms.pdf', contents: $this->organization->termsPdf())];
}
public function canBeSigned(): bool { return $this->state === 'validated'; }
public function signableVersion(): ?string { return (string) $this->revision; } // content only, not updated_at
public function signableBranding(): BrandingData
{
return new BrandingData(name: $this->organization->name, logo_url: $this->organization->logo_url, color: '#2563eb');
}
}
use OiLab\OiLaravelSign\Data\SignerData;
$request = $quote->requestSignature(
new SignerData(name: 'Jeanne Martin', email: '[email protected]', phone: '+33612345678'),
[
'owner' => $quote->organization,
'otp_channel' => 'sms',
'consent_text' => 'Bon pour accord',
'notify' => false, // send the link in your own e-mail instead
],
);
$request->sign_url; // only available now: the token is stored hashed
$quote->latestSignature()?->status; // SignatureStatus
$quote->isSigned();
use OiLab\OiLaravelSign\Actions\{CancelSignature, ResendSignature, VerifySignedDocument};
ResendSignature::handle($signatureRequest); // new link, previous one retired
CancelSignature::handle($signatureRequest, 'Wrong price');
VerifySignedDocument::handle($signatureRequest)->valid;
$signatureRequest->evidence()->toArray(); // the full evidence file
bash
php artisan sign:expire # expire stale requests (scheduled hourly)
php artisan sign:verify {uuid} [--file=] # check the stored (or a given) signed PDF
php artisan sign:evidence {uuid} [--output=] # export the evidence file as JSON
php artisan sign:make-certificate # self-signed seal certificate for development