PHP code example of kduma / signed-document

1. Go to this page and download the library: Download kduma/signed-document 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/ */

    

kduma / signed-document example snippets


$signer = new \Kduma\SignedDocument\DocumentSigner(
    \ParagonIE\Halite\KeyFactory::generateSignatureKeyPair()->getSecretKey()
);

$document_1 = \Kduma\SignedDocument\Document::make("Some Content", 'test-document');
$document_1->addSignature($signer->sign($document_1, 'ceo'));

$document_2 = \Kduma\SignedDocument\Document::make("Some  Other Content", 'other-document');
$document_2->addSignature($signer->sign($document_2, 'ceo'));

$collection = new \Kduma\SignedDocument\DocumentCollection();
$collection->addDocument($document_1);
$collection->addDocument($document_2);

echo $collection->getXml();

$signer = new \Kduma\SignedDocument\DocumentValidator();

$collection = \Kduma\SignedDocument\DocumentCollection::fromXml('<?xml version="1.0" encoding="UTF-8"