Download the PHP package beziworld/laravel-xades without Composer

On this page you can find all versions of the php package beziworld/laravel-xades. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-xades

Laravel XAdES

tests Latest Version

XAdES signing and verification of XML documents in Laravel, with a PKCS#12 (.p12/.pfx) or PEM certificate. Built for Polish e-government XML (KSeF AuthTokenRequest, JPK InitUpload, e-Deklaracje and other documents that require a XAdES signature), usable for any XML.

Interoperability was checked both ways with the signing code of the official KSeF C# client (.NET SignedXml): signatures made by this package verify in .NET, and the .NET signature is part of the test suite.

Polska wersja dokumentacji

Why this package

robrichards/xmlseclibs (95M downloads) lyquidity/xml-signer (107k) this package
XML Signature yes yes (on xmlseclibs) yes
XAdES qualifying properties no, build them yourself yes, including policies, counter-signatures, time-stamps BES and B-B, no time-stamps
Rejects duplicated identifiers (wrapping) left to the caller not documented yes, always
Validation of the output against the XAdES XSD no not documented yes, official XSD bundled
Laravel config, facade, rule, commands no no yes
Last release active January 2023 new

On Packagist (November 2026) there is no Laravel package for XAdES. xmlseclibs is a solid low-level XML Signature library, but XAdES needs more than that: the SignedProperties reference with its Type, the QualifyingProperties bound to the signature Id, the signing certificate digest, and a verifier that knows which element each reference may point at. lyquidity/xml-signer covers much more of XAdES (time-stamps, LT/LTA, policies) but is framework-agnostic, needs ext-gmp and ext-curl for its OCSP/TSP client and has not been released since 2023. This package does the common case (sign and verify XAdES-BES / B-B with a file certificate) the Laravel way, implementing XML Signature directly on ext-dom canonicalization (the same libxml C14N that xmlseclibs uses) and phpseclib, so that every reference is resolved under strict rules.

Installation

Requirements: PHP 8.3+, Laravel 12 or 13, ext-dom, ext-openssl.

More certificates (for example several company seals) go to certificates in config/xades.php:

Signing

Credentials stored elsewhere (per tenant, in a vault):

The signer refuses RSA keys below 2048 bits, EC keys below 256 bits and a key that does not belong to the certificate. The produced structure (default bes profile):

KSeF 2.0 authentication example

KSeF accepts enveloped and enveloping signatures only (not detached). Which certificates an authority accepts is decided by the authority: see Limits.

Verification

Options: trusted, require_trusted, allow_weak_algorithms, check_validity_period, require_whole_document, detached, signature_id, certificate (used when KeyInfo has no certificate), max_references, clock_skew. Defaults come from xades.verification.

What is checked, and in which order:

  1. The document is parsed without network access; any DOCTYPE or ENTITY declaration is rejected (no XXE, no entity expansion, no DTD-declared IDs).
  2. Exactly one top-level ds:Signature (or the one named by signature_id) with a unique Id.
  3. Canonicalization and signature methods from the allow list; SHA-1 only with allow_weak_algorithms.
  4. One xades:QualifyingProperties in a ds:Object of this signature, with Target="#<signature Id>".
  5. Every reference: URI="" (the document), #id (exactly one element with that Id/ID/id, so a duplicated identifier is rejected as a wrapping attempt) or an external URI resolved from detached; transforms limited to enveloped-signature and one Canonical XML 1.0 / Exclusive C14N 1.0; digest compared in constant time.
  6. Exactly one reference covers the SignedProperties of this signature; a reference typed as SignedProperties must point at them.
  7. Enveloped and enveloping signatures must cover the whole document (every non-property ds:Object for enveloping), unless require_whole_document is false; then read data only from signedContents.
  8. The certificate whose digest equals SigningCertificate(V2)/Cert/CertDigest is the signing certificate; X509SerialNumber and IssuerSerialV2 must match it; X509IssuerName is compared leniently (other implementations write names differently) and a difference is reported as a warning.
  9. The signature value over the canonical SignedInfo with that certificate; RSA keys below 2048 bits rejected.
  10. The certificate must be valid at SigningTime (check_validity_period), and trusted when require_trusted is set: pinned in trusted or directly issued by a certificate in trusted.

Validation rule

Schema validation

Each ds:Signature is validated against the W3C XML Signature schema and its QualifyingProperties against XAdES01903v132-201601.xsd of ETSI EN 319 132-1 (which also defines SigningCertificateV2). Both files are bundled in resources/schema; the import of the XAdES schema points at the local copy and the DOCTYPE of the W3C file is removed, so validation never reaches the network.

Artisan

xades:certificate exits with an error when the certificate expires soon, so it can run in the scheduler.

Events

Beziworld\Xades\Events\DocumentSigned (certificate name, packaging, signature id, certificate SHA-256 fingerprint) is dispatched after each signature; no document or key material is included. Disable with XADES_EVENTS=false.

Limits

Errors

Exception When
InvalidConfiguration unknown certificate name, missing key/certificate/password, invalid option
InvalidCertificate unreadable certificate, key or PKCS#12, wrong password, key not matching the certificate, weak key
InvalidDocument empty or malformed XML, DOCTYPE/ENTITY declarations, document larger than 50 MB
InvalidSignature verification failed; reason() returns a stable code such as digest_mismatch, signature_mismatch, ambiguous_reference, partial_document, signing_certificate_mismatch, untrusted_certificate, weak_algorithm
SchemaViolation the signature does not conform to the XML Signature or XAdES schema; errors() lists libxml messages
SigningFailed the private key operation or serialization failed

All exceptions extend Beziworld\Xades\Exceptions\XadesException.

Development

Tests generate throwaway RSA and EC keys and certificates (self-signed and issued by a test CA) at runtime with phpseclib; no private key is stored in the repository. tests/Fixtures/ksef-dotnet-signed.xml is an AuthTokenRequest signed by the signing code of the official KSeF C# client (public certificate only).

Author

Created and maintained by Kamil Ćwiertnia, beziworld.eu.

Need an integration? Get in touch through beziworld.eu.

Related packages

laravel-ksef · laravel-jpk · laravel-wezel-krajowy

License

MIT. See LICENSE.md. The bundled schemas are published by ETSI (XAdES) and the W3C (XML Signature) under their own terms. This package is not affiliated with or endorsed by ETSI, the W3C, the Polish Ministry of Finance or any trust service provider.


All versions of laravel-xades with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-dom Version *
ext-libxml Version *
ext-mbstring Version *
ext-openssl Version *
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.0
phpseclib/phpseclib Version ^3.0.43
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beziworld/laravel-xades contains the following files

Loading the files please wait ...