PHPackages                             ninosimeon/xmlseclibs\_sunat - 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. ninosimeon/xmlseclibs\_sunat

ActiveLibrary[Security](/categories/security)

ninosimeon/xmlseclibs\_sunat
============================

A PHP library for XML Security

3.0.1(9y ago)1216BSD-3-ClausePHPPHP &gt;= 5.3

Since May 21Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (18)Used By (0)

\#xmlseclibs\_sunat

xmlseclibs\_sunat es una librería hecha en PHP para la firma electrónica de documentos XML.

El autor de xmlseclibs es Rob Richards. Repositorio oficial:

Requerimientos
==============

[](#requerimientos)

xmlseclibs\_sunat requiere PHP 5.3 o mayor.

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

[](#how-to-install)

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

```
php composer.phar require "ninosimeon/xmlseclibs_sunat"
```

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('ds', $signId);
// 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

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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

Every ~56 days

Recently: every ~49 days

Total

13

Last Release

3338d ago

Major Versions

1.4.1 → 2.0.02015-07-31

1.4.2 → 2.0.x-dev2016-09-23

1.4.x-dev → 3.0.02017-03-22

PHP version history (2 changes)1.4.0PHP &gt;= 5.2

2.0.0PHP &gt;= 5.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1450565?v=4)[Nino Simeon](/maintainers/ninosimeon)[@ninosimeon](https://github.com/ninosimeon)

---

Top Contributors

[![robrichards](https://avatars.githubusercontent.com/u/210629?v=4)](https://github.com/robrichards "robrichards (64 commits)")[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (6 commits)")[![ninosimeon](https://avatars.githubusercontent.com/u/1450565?v=4)](https://github.com/ninosimeon "ninosimeon (6 commits)")[![RichWeber](https://avatars.githubusercontent.com/u/1702252?v=4)](https://github.com/RichWeber "RichWeber (4 commits)")[![tmilos](https://avatars.githubusercontent.com/u/1818373?v=4)](https://github.com/tmilos "tmilos (3 commits)")[![hiddewie](https://avatars.githubusercontent.com/u/1073881?v=4)](https://github.com/hiddewie "hiddewie (3 commits)")[![jaimeperez](https://avatars.githubusercontent.com/u/1942728?v=4)](https://github.com/jaimeperez "jaimeperez (3 commits)")[![klemenb](https://avatars.githubusercontent.com/u/2099210?v=4)](https://github.com/klemenb "klemenb (3 commits)")[![thijskh](https://avatars.githubusercontent.com/u/3808792?v=4)](https://github.com/thijskh "thijskh (2 commits)")[![gfaust-qb](https://avatars.githubusercontent.com/u/13354975?v=4)](https://github.com/gfaust-qb "gfaust-qb (1 commits)")[![BernardoSilva](https://avatars.githubusercontent.com/u/1537510?v=4)](https://github.com/BernardoSilva "BernardoSilva (1 commits)")

---

Tags

xmlsecuritysignaturexmldsig

### Embed Badge

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

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

###  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)
