With this packages you can digitally sign pdf files with a certificate.
You can install the package via composer:
composer require devraeph/laravel-pdf-signer
You can publish the config file with:
php artisan vendor:publish --provider="DevRaeph\PdfSigner\PdfSignerServiceProvider" --tag="pdf-signer-config"
This is the contents of the published config file:
return [
"business" => "",
"reason" => "",
"url" => "",
"cert" => env("SIGNER_CERT_PATH","cert/test.crt"),
"key" => env("SIGNER_KEY_PATH","cert/key.key"),
"password" => env("SIGNER_KEY_PASSWORD","")
];
Generate Key file withour password:
openssl genrsa -out example.key 4096
Generate Key file with password set:
openssl genrsa -aes128 -passout pass:MyStrongPwd -out example.key 4096
Generate self signed Certificate:
openssl openssl req -x509 -nodes -days 365000 -key example.key -out example.crt
Following vars have to be set in .env file:
SIGNER_CERT_PATH
Storage path of created certificate
SIGNER_KEY_PATH
Storage path of created key file
SIGNER_KEY_PASSWORD
optional password for key file
Only use Facade to interact with the PDF Signer.
use DevRaeph\PdfSigner\Facades\PdfSigner;
/* Load file from Storage path */
PDFSigner::loadFile("example.pdf")
->setSavePath() //Optional save Path
->sign();
The MIT License (MIT). Please see License File for more information.