PHP code example of accredifysg / php-rdf-canonicalize
1. Go to this page and download the library: Download accredifysg/php-rdf-canonicalize 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/ */
accredifysg / php-rdf-canonicalize example snippets
use Accredify\RdfCanonicalize\RDFC10;
$nquads = <<<NQ
_:b0 <https://schema.org/name> "John Doe" .
_:b0 <https://schema.org/knows> _:b1 .
_:b1 <https://schema.org/name> "Jane Doe" .
NQ;
$canonical = (new RDFC10)->canonicalize($nquads);
// $canonical is a sorted list of canonical N-Quads, one per element.
echo implode('', $canonical);
// _:c14n0 <https://schema.org/knows> _:c14n1 .
// _:c14n0 <https://schema.org/name> "John Doe" .
// _:c14n1 <https://schema.org/name> "Jane Doe" .
use Accredify\JsonLd\JsonLdProcessor;
use Accredify\RdfCanonicalize\RDFC10;
$nquads = (new JsonLdProcessor($loader))->toRdf($jsonLd)->toNQuads();
$canonical = (new RDFC10)->canonicalize($nquads, ['inputFormat' => 'application/n-quads']);
$canonical = (new RDFC10(hashAlgorithm: 'sha384'))->canonicalize($nquads);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.