devraeph/laravel-pdf-signer

Laravel PDF Signer by DevRaeph

1.0.1 2021-09-08 08:51 UTC

This package is auto-updated.

Last update: 2024-11-29 01:28:00 UTC


README

Logo

PDF Signer by DevRaeph

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

ko-fi

License

The MIT License (MIT). Please see License File for more information.