devraeph / laravel-pdf-signer
Laravel PDF Signer by DevRaeph
Fund package maintenance!
:vendor_name
Requires
- php: ^7.4
- illuminate/contracts: ^8.37
- setasign/fpdi: ^2.0
- spatie/laravel-package-tools: ^1.4.3
- tecnickcom/tcpdf: 6.3.*
Requires (Dev)
- brianium/paratest: ^6.2
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- spatie/laravel-ray: ^1.23
- vimeo/psalm: ^4.8
README
PDF Signer by DevRaeph
With this packages you can digitally sign pdf files with a certificate.
Installation
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","") ];
Create self signed Certificate
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
Environment Variables
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
Usage
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();
Credits
Sponsor
License
The MIT License (MIT). Please see License File for more information.