PHP code example of marcelxyz / php-xml-digital-signature

1. Go to this page and download the library: Download marcelxyz/php-xml-digital-signature library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marcelxyz / php-xml-digital-signature example snippets


$dsig = new XmlDsig\XmlDigitalSignature();

$dsig->loadPrivateKey('path/to/private/key', 'passphrase');
$dsig->loadPublicKey('path/to/public/key');

$dsig->addObject('I am a data blob.');
$dsig->sign();

$result = $dsig->getSignedDocument();