Skip to content
Firma digital de Facturación Electrónica (SUNAT - Perú)
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix date key May 29, 2019
tests move manual test to CI May 26, 2019
.gitattributes update ignore files Jan 22, 2018
.gitignore fix tests, exclude files Jan 3, 2018
.travis.yml include composer install May 26, 2019 update to v5 Feb 25, 2018 update vendor path Feb 16, 2018
LICENSE prep for release Sep 8, 2016 Update descriptions, example Jun 10, 2019
composer.json set require extensions May 26, 2019
phpunit.xml fix phpunit config, remove codacy badge Jan 3, 2018
xmlseclibs.php update xmldsig origin changes May 26, 2019

XmlDSig - Greenter

Travis-CI Codacy Badge

Esta libreria se emplea para firmar comprobantes electrónicos según las normas de SUNAT.

Se requiere el certificado en formato .PEM, puede utilizar el siguiente ejemplo para convertir el certificado .PFX al otros formatos.


Empleando composer desde packagist.

composer require greenter/xmldsig


use Greenter\XMLSecLibs\Sunat\SignedXml;

require 'vendor/autoload.php';

$xmlPath = '20600995805-01-F001-1.xml';
$certPath = 'certifcate.pem'; // Convertir pfx to pem (public+private key) 

$signer = new SignedXml();

$xmlSigned = $signer->signFromFile($xmlPath);

file_put_contents("signed.xml", $xmlSigned);





            <ds:Signature Id="SignIMM">
                    <ds:CanonicalizationMethod Algorithm=""/>
                    <ds:SignatureMethod Algorithm=""/>
                    <ds:Reference URI="">
                        <ds:Transform Algorithm=""/>
                    <ds:DigestMethod Algorithm=""/>
You can’t perform that action at this time.