paulo-hortelan / signum
This is my package signum
Fund package maintenance!
Requires
- php: ^8.1
- barryvdh/laravel-dompdf: ^3.1
- illuminate/contracts: ^10.0|^11.0|^12.0
- simplesoftwareio/simple-qrcode: ^4.2
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.29
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2026-05-06 17:12:43 UTC
README
Signum is a Laravel package to generate, sign, display, download, and validate course certificates.
It includes:
- digital signature support with RSA private/public keys
- certificate preview and PDF download routes
- browser-friendly validation page and JSON API validation response
- multi-page certificate support (course content appendices)
- i18n support (
enandpt_BR) - signature rendering as either text or image
Requirements
- PHP
^8.1 - Laravel
10,11, or12
Installation
composer require paulo-hortelan/signum
Publish package files:
php artisan vendor:publish --tag=signum-config php artisan vendor:publish --tag=signum-views php artisan vendor:publish --tag=signum-translations php artisan vendor:publish --tag=signum-assets php artisan vendor:publish --tag=signum-migrations
Run migrations:
php artisan migrate
Quick Start
1) Configure keys
Generate keys:
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048 openssl rsa -pubout -in private.pem -out public.pem
Set .env:
SIGNUM_PRIVATE_KEY_PATH=/absolute/path/private.pem SIGNUM_PUBLIC_KEY_PATH=/absolute/path/public.pem SIGNUM_VALIDATION_URL=https://your-domain.com/signum/certificates/validate
Docker note:
- Paths must exist inside the container (for example
/run/secrets/signum_private.pem). - The PHP process user inside the container must have read permission.
- If mounting key files is inconvenient, you can provide inline keys with
SIGNUM_PRIVATE_KEYandSIGNUM_PUBLIC_KEY.
2) Generate a certificate
use PauloHortelan\Signum\Facades\Signum; $certificate = Signum::generateCertificate([ 'recipient_name' => 'Jane Doe', 'course_name' => 'Advanced Laravel', 'locale' => 'en', 'meta' => [ 'content_sections' => [ [ 'title' => 'Module 1 - Fundamentals', 'items' => ['Service Container', 'Events', 'Queues'], ], [ 'title' => 'Module 2 - Delivery', 'items' => ['Testing', 'CI/CD'], ], ], ], 'signature_display' => [ 'type' => 'text', 'text' => 'Jane Instructor', ], ]);
3) Access routes
By default:
GET /signum/certificates/{code}GET /signum/certificates/{code}/downloadGET /signum/certificates/validate?code={code}
Development-only route (enabled in local/testing by default):
GET /signum/certificates/demo
Production recommendation:
SIGNUM_DEMO_ROUTE_ENABLED=false
Validation Endpoint (Web + API)
The same endpoint supports both browser and API consumers:
Accept: text/html-> renders a styled validation pageAccept: application/json-> returns JSON
Example:
curl -H "Accept: application/json" \ "https://your-domain.com/signum/certificates/validate?code=01H..."
Signature Display Options
Text signature:
'signature_display' => [ 'type' => 'text', 'text' => 'Jane Instructor', ]
Uploaded image signature:
'signature_display' => [ 'type' => 'image', 'image_upload' => $request->file('signature'), ]
Pre-existing image path:
'signature_display' => [ 'type' => 'image', 'image_path' => storage_path('app/public/signatures/director.png'), ]
Localization
Supported locales:
en(default)pt_BR
You can set locale per certificate (locale field) or globally (SIGNUM_DEFAULT_LOCALE).
Customization Guide
After publishing files, you can customize:
config/signum.php: route prefix, default locale, validation URL, storage disk, default viewsresources/views/vendor/signum/certificate.blade.php: certificate and appendix layoutresources/views/vendor/signum/validation.blade.php: browser validation page layoutlang/vendor/signum/{locale}/signum.php: labels and copypublic/vendor/signum/images/*: logo/background/signature assets
Useful config entries:
certificate.viewcertificate.pdf_viewcertificate.validation_viewcertificate.layout.print_widthcertificate.layout.print_heightcertificate.imagescertificate.text_overridescertificate.custom_htmlcertificate.signature_uploaddemo_route_enabled
Local Package Development
This repository is a package (no root artisan).
Run local testbench server:
composer run serve
List package routes:
composer run routes
Quality Checks
composer test
php vendor/bin/pint --test
php vendor/bin/phpstan analyse
Changelog
See CHANGELOG.md.
License
MIT. See LICENSE.md.