PHPackages                             cabreran/xmlseclibs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. cabreran/xmlseclibs

ActiveLibrary[Security](/categories/security)

cabreran/xmlseclibs
===================

A PHP library for XML Security

v3.1.0(5y ago)013.9k↓75%BSD-3-ClausePHPPHP &gt;= 7.1

Since Jul 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cabreran/xmlseclibs)[ Packagist](https://packagist.org/packages/cabreran/xmlseclibs)[ Docs](https://github.com/cabreran/xmlseclibs)[ RSS](/packages/cabreran-xmlseclibs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

\#xmlseclibs

xmlseclibs is a library written in PHP for working with XML Encryption and Signatures.

Requirements
============

[](#requirements)

xmlseclibs requires PHP version 7.1 or greater.

How to Install
--------------

[](#how-to-install)

Install with [`composer.phar`](http://getcomposer.org).

```
php composer.phar require "cabreran/xmlseclibs"
```

Use cases
---------

[](#use-cases)

xmlseclibs is being used in many different software.

- [SimpleSAMLPHP](https://github.com/simplesamlphp/simplesamlphp)
- [LightSAML](https://github.com/lightsaml/lightsaml)
- [OneLogin](https://github.com/onelogin/php-saml)

Basic usage
-----------

[](#basic-usage)

The example below shows basic usage of xmlseclibs, with a SHA-256 signature.

```
use Cabreran\XMLSecLibs\XMLSecurityDSig;
use Cabreran\XMLSecLibs\XMLSecurityKey;

// Load the XML to be signed
$doc = new DOMDocument();
$doc->load('./path/to/file/tobesigned.xml');

// Create a new Security object
$objDSig = new XMLSecurityDSig();
// Use the c14n exclusive canonicalization
$objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
// Sign using SHA-256
$objDSig->addReference(
    $doc,
    XMLSecurityDSig::SHA256,
    array('http://www.w3.org/2000/09/xmldsig#enveloped-signature')
);

// Create a new (private) Security key
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type'=>'private'));
/*
If key has a passphrase, set it using
$objKey->passphrase = '';
*/
// Load the private key
$objKey->loadKey('./path/to/privatekey.pem', TRUE);

// Sign the XML file
$objDSig->sign($objKey);

// Add the associated public key to the signature
$objDSig->add509Cert(file_get_contents('./path/to/file/mycert.pem'));

// Append the signature to the XML
$objDSig->appendSignature($doc->documentElement);
// Save the signed XML
$doc->save('./path/to/signed.xml');
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2131d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4743761?v=4)[Nelson Cabrera](/maintainers/cabreran)[@cabreran](https://github.com/cabreran)

---

Top Contributors

[![cabreran](https://avatars.githubusercontent.com/u/4743761?v=4)](https://github.com/cabreran "cabreran (1 commits)")

---

Tags

xmlsecuritysignaturexmldsig

### Embed Badge

![Health badge](/badges/cabreran-xmlseclibs/health.svg)

```
[![Health](https://phpackages.com/badges/cabreran-xmlseclibs/health.svg)](https://phpackages.com/packages/cabreran-xmlseclibs)
```

###  Alternatives

[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[greenter/xmldsig

Libreria para firmar XML según normativa de SUNAT en Facturación Electrónica

38794.6k9](/packages/greenter-xmldsig)[ass/xmlsecurity

The XmlSecurity library is written in PHP for working with XML Encryption and Signatures

955.6M30](/packages/ass-xmlsecurity)[fr3d/xmldsig

Tool for easy management of XML Signatures (http://www.w3.org/TR/xmldsig-core/)

63150.6k1](/packages/fr3d-xmldsig)[lyquidity/xml-signer

A PHP to create and verify XAdES signature

2164.6k1](/packages/lyquidity-xml-signer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
