PHPackages                             draganmorty/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. draganmorty/xmlseclibs

ActiveLibrary[Security](/categories/security)

draganmorty/xmlseclibs
======================

A PHP library for XML Security

v1.0(8y ago)01101BSD-3-ClausePHPPHP &gt;= 5.3

Since Feb 12Pushed 8y agoCompare

[ Source](https://github.com/draganmorty/xmlseclibs)[ Packagist](https://packagist.org/packages/draganmorty/xmlseclibs)[ Docs](https://github.com/robrichards/xmlseclibs)[ RSS](/packages/draganmorty-xmlseclibs/feed)WikiDiscussions master Synced yesterday

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

\#xmlseclibs

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

The author of xmlseclibs is Rob Richards.

Branches
========

[](#branches)

Both the master and the 1.4 branches are actively maintained. The 1.3 branch is only updated for security related issues.

- master: Contains namespace support requiring 5.3+.
- 1.4: Contains auto-loader support while also maintaining backwards compatiblity with the 1.3 version using the xmlseclibs.php file. Supports PHP 5.2+

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

[](#requirements)

xmlseclibs requires PHP version 5.3 or greater.

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

[](#how-to-install)

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

```
php composer.phar require "robrichards/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)

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

[](#basic-usage)

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

```
use RobRichards\XMLSecLibs\XMLSecurityDSig;
use RobRichards\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'));
// Load the private key
$objKey->loadKey('./path/to/privatekey.pem', TRUE);
/*
If key has a passphrase, set it using
$objKey->passphrase = '';
*/

// 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');
```

How to Contribute
-----------------

[](#how-to-contribute)

- [Open Issues](https://github.com/robrichards/xmlseclibs/issues)
- [Open Pull Requests](https://github.com/robrichards/xmlseclibs/pulls)

Mailing List:

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

3012d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a9617578e7eec39f3d5377135f9fc8449f311e5ceefc8f310290b0a8d16c874?d=identicon)[draganmorty](/maintainers/draganmorty)

---

Top Contributors

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

---

Tags

xmlsecuritysignaturexmldsig

### Embed Badge

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

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

###  Alternatives

[robrichards/xmlseclibs

A PHP library for XML Security

41278.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)
