Download the PHP package accredifysg/php-rdf-canonicalize without Composer

On this page you can find all versions of the php package accredifysg/php-rdf-canonicalize. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-rdf-canonicalize

PHP-RDF-Canonicalize

CI Packagist Version PHP Version License W3C rdf-canon

A PHP implementation of the W3C RDF Dataset Canonicalization (RDFC-1.0) algorithm (the standard that supersedes URDNA2015).

Status: stable (1.0). Extracted from accredifysg/verifiable-credentials-php (mirroring how accredifysg/php-json-ld was), and fully conformant with the W3C rdf-canon suite (86/86). The public API and the canonical output are covered by Semantic Versioning — breaking either bumps the major version. The output is consensus-critical: VC's eddsa-rdfc-2022 and ecdsa-sd-2023 signatures are computed over it — see Parity.

What it does

RDFC-1.0 takes an RDF dataset and produces a canonical (deterministic) serialization, so that two datasets that are equal up to blank-node relabelling serialise to exactly the same bytes. That canonical form is what gets hashed and signed by Data Integrity cryptographic suites.

This package operates purely on an RDF dataset expressed as N-Quads:

Converting JSON-LD to N-Quads (the toRdf algorithm) is out of scope and is the caller's responsibility — use accredifysg/php-json-ld's toRdf() for that. This package intentionally has no dependency on php-json-ld.

Installation

Requires PHP 8.2+ with the hash (SHA-256) and mbstring extensions.

Usage

RDFC10 implements Accredify\RdfCanonicalize\Contracts\Canonicalizer. After canonicalising, getCanonicalIdMap() returns the map of original → canonical blank node identifiers.

Pairing it with php-json-ld to canonicalise a JSON-LD document:

Hash algorithm

RDFC-1.0 uses SHA-256 by default. Pass the spec's optional SHA-384 profile (or any algorithm hash_algos() reports) via the constructor:

Components

The N-Quads I/O is factored into two reusable, composable classes that RDFC10 uses internally and accepts via its constructor:

Scope

Out of scope for the 1.x line: JSON-LD → N-Quads conversion (use php-json-ld).

Parity with verifiable-credentials-php

The canonical output is a frozen, consensus-critical contract: VC's eddsa-rdfc-2022 and ecdsa-sd-2023 suites sign over it. For the N-Quads VC actually produces (via php-json-ld's toRdf), the output is byte-for-byte identical to the implementation VC originally shipped — verified by replaying the full pipeline over real signed credentials (see tools/corpus-replay.php).

tests/ParityTest.php locks this with exact-byte fixtures. Under SemVer, changing the canonical output is a major version bump, paired with a coordinated regeneration of VC's signed fixtures.

Conformance

Tested against the official W3C rdf-canon test suite, pulled in as a git submodule at tests/w3c/. See tests/W3c/README.md for the harness layout.

Score (v1.0.0) — full conformance

Test type W3C suite Passing
Eval 64 64
Map (identifiers) 21 21
NegativeEval 1 1
Total 86 86

The W3C suite gates CI (no allowlist — every case passes). The canonical output is frozen under SemVer; a future change would be a major version bump plus a coordinated regeneration of VC's signed fixtures. See the CHANGELOG for the 0.x → 1.0 conformance history.

License

MIT © Accredify


All versions of php-rdf-canonicalize with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-hash Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package accredifysg/php-rdf-canonicalize contains the following files

Loading the files please wait ...