- How do I install tecnickcom/tc-lib-pdf-sign in a Laravel app?
- Install it with Composer using composer require tecnickcom/tc-lib-pdf-sign. There is no Laravel-specific setup; use it inside a service class, controller, or queued job. Make sure the OpenSSL PHP extension is enabled and your signing certificate and private key are available to the application.
- Does tc-lib-pdf-sign have a Laravel service provider or facade?
- No official Laravel service provider or facade is provided because the package is framework-agnostic PHP. You can register your own singleton binding or wrap it in a small service class for dependency injection. Keep certificate paths and private key passphrases in config or environment variables rather than source control.
- What PHP extensions and certificate files do I need to sign PDFs?
- You need the OpenSSL PHP extension plus a valid X.509 certificate and its matching private key. For CAdES or PAdES signatures you may also need the intermediate certificate chain so readers can validate the signer. Store keys outside the public web root and load them from environment variables or a secrets manager.
- What is the difference between PKCS#7, CAdES, and PAdES signatures?
- PKCS#7 is the classic CMS-based signature format commonly embedded in PDFs. CAdES is a CMS-based advanced electronic signature standard with options for long-term validation. PAdES is the ETSI standard built specifically for PDF documents and is often preferred for archival and compliance use cases.
- Can tc-lib-pdf-sign add a digital signature to an existing PDF?
- The package is designed to create and embed digital signatures in PDF documents, typically within tc-lib-pdf or compatible PDF generation workflows. Signing arbitrary existing PDFs depends on whether your workflow supports incremental updates without breaking the original file. Test with your actual PDF source and validate the result in a standards-compliant PDF reader.
- How do I verify a signed PDF in Laravel?
- Verification is usually performed by PDF readers such as Adobe Acrobat or by OpenSSL-based tooling that checks the CMS signature and document integrity. The package focuses on producing signatures that readers can validate, so automated verification often uses OpenSSL or a dedicated verification library. In Laravel, run verification in a queued job and store the validation result for auditing.
- Which Laravel and PHP versions are supported?
- Because the package is framework-agnostic, Laravel version support is mainly determined by PHP and Composer compatibility. Any Laravel release running a supported PHP version with OpenSSL enabled can use it. Check the package composer.json for the exact PHP constraint before upgrading.
- Is tc-lib-pdf-sign safe to use in production?
- It can be used in production if you protect private keys, restrict file permissions, and avoid logging passphrases or key material. Validate certificate chains and test signed PDFs with the readers your users rely on. If you need long-term validation, consider timestamping or LTV options supported by your signature profile.
- Are there alternatives to tc-lib-pdf-sign for signing PDFs in PHP?
- Alternatives include TCPDF's signature support, tc-lib-pdf with signing, commercial libraries such as SetaPDF-Signer, and command-line pipelines using OpenSSL or qpdf. The best choice depends on your required PAdES or CAdES profile, existing PDF workflow, and licensing budget. For many Laravel projects, a thin wrapper around tc-lib-pdf-sign is the simplest option.
- How should I test PDF signing without using a real certificate?
- Generate a self-signed test certificate and private key with OpenSSL and keep them only in test fixtures or CI secrets. Sign a sample PDF and assert that the output contains a signature dictionary and validates in a reader or OpenSSL. Never commit production keys, and rotate test certificates as needed.