lsnepomuceno/signet-pdf
Signet PDF is a Laravel package for digitally signing PDF documents. It provides a simple API for adding X.509 certificate signatures to existing or generated PDFs, helping PHP applications implement document authenticity, signature validation, and secure signing workflows with minimal setup.
composer require lsnepomuceno/signet-pdf:^3.0. Confirm the PHP and extension requirements in the package's composer.json; signing needs OpenSSL, and ICP-Brasil certificate handling may also require mbstring/gmp.UPGRADE.md (three breaking changes), the 3.0.0 CHANGELOG.md, then the v3 documentation site. Do not follow 1.x/2.x snippets — those docs are archived at /v1/ and /v2/.use Lsnepomuceno\Signet\Facades\Signet;
use Lsnepomuceno\Signet\Enums\PadesProfile;
use Lsnepomuceno\Signet\Enums\SignaturePolicy;
$policy = SignaturePolicy::forProfile(PadesProfile::PadesADRB);
$signed = Signet::pdf(Storage::path('contracts/in.pdf'))
->withPolicy($policy)
->sign($certificatePath, $password);
Storage::disk('s3')->writeStream(
'contracts/signed.pdf',
$signed->document->stream()
);
$receipt = $signed->receipt(); // policy, profile, digest, signer, timestamps
PBAD_ entries end to end.Support\DocumentBuffer exists to avoid holding the document twice. Read from Storage::readStream() or a temporary path, pass the buffer through signing, and stream the result directly to its destination. Avoid file_get_contents(), base64_encode(), and response helpers that buffer the full body.SignaturePolicy::forProfile(...) and treat a null result as "ITI publishes no such policy," not as a package error. For long-term/archival signatures, use the ICP-Brasil archival profiles (AD-RB/AD-RT) that the package now makes conformant; B-LT is not one of them.Signer service so controllers and jobs do not know whether signing is local or remote.DocumentBuffer or PDF bytes into the queue payload. Store the receipt in the same transaction or job step as the signed file.receipt() as audit data. It records what was signed, under which policy/profile. Keep it alongside the document hash, signer identity, timestamp information, and the Verificador result. The signed bytes alone do not tell you which policy was applied.response()->streamDownload()), a validation rule for uploaded PDFs, and events/listeners for "document signed" so notifications and audits are decoupled from the signing call.PreparedSignature::$document is no longer a string. It is a Support\DocumentBuffer. Any strlen(), echo, base64_encode(), string concatenation, or Storage::put($path, $signed->document) will break. Move to the buffer's stream/write API and update tests that assert on string contents.intervention/image 4.x is required. Applications pinned to 3.x will hit Composer conflicts. Check direct and transitive constraints before upgrading; Image 4 also has its own API changes if you use it directly.SignaturePolicy::forProfile(PadesBLT) returns null by design. Do not "fix" this with a fallback policy. ITI publishes no B-LT policy that the signature satisfies; select an archival ICP-Brasil profile instead.memory_limit above the document size plus PHP/library overhead. Disable output buffering, avoid loading the result into a response string, and stream downloads.PBAD_ entries are required for ICP-Brasil archival conformance, but Adobe or other PAdES tools may report differently. Test against the validator your users/customers actually rely on.DocumentBuffer migration a one-place change.How can I help you explore Laravel packages today?