1. Go to this page and download the library: Download authentin/eusig-bundle 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/ */
authentin / eusig-bundle example snippets
use Authentin\Eusig\Contract\SignerInterface;
use Authentin\Eusig\Model\Document;
use Authentin\Eusig\Model\SignatureLevel;
use Authentin\Eusig\Model\SignatureParameters;
use Symfony\Component\HttpFoundation\Response;
class SignController
{
public function __invoke(SignerInterface $signer): Response
{
$signed = $signer->sign(
Document::fromLocalFile('/path/to/document.pdf'),
new SignatureParameters(signatureLevel: SignatureLevel::PAdES_BASELINE_B),
);
return new Response($signed->content, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="signed.pdf"',
]);
}
}
use Authentin\Eusig\Contract\ValidatorInterface;
use Authentin\Eusig\Model\Document;
class ValidateController
{
public function __invoke(ValidatorInterface $validator): Response
{
$result = $validator->validateSignature(
Document::fromLocalFile('/path/to/signed.pdf'),
);
return $this->json([
'valid' => $result->valid,
'signatures' => $result->signaturesCount,
]);
}
}
use Authentin\Eusig\Contract\SigningClientInterface;
use Authentin\Eusig\Model\Document;
use Authentin\Eusig\Model\SignatureLevel;
use Authentin\Eusig\Model\SignatureParameters;
class ExtendController
{
public function __invoke(SigningClientInterface $signingClient): Response
{
$extended = $signingClient->extendDocument(
Document::fromLocalFile('/path/to/signed.pdf'),
new SignatureParameters(signatureLevel: SignatureLevel::PAdES_BASELINE_T),
);
$extended->saveToFile('/path/to/extended.pdf');
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.