fairpm / did-manager
Core PHP library for DID management, key handling, and PLC operations
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- simplito/elliptic-php: ^1.0
- spomky-labs/cbor-php: ^3.1
- yocto/yoclib-multibase: ^1.2
Requires (Dev)
- carthage-software/mago: ^1.0.0-rc.12
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpcompatibility/php-compatibility: ^9.3
- phpunit/phpunit: ^10.0
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2026-05-16 23:51:33 UTC
README
fairpm/did-manager is the core FAIR DID library. It contains generic DID lifecycle management, PLC operations, key generation/export, and local key storage.
Features
- Create, resolve, update, rotate, and deactivate
did:plcidentifiers - Generate secp256k1 rotation keys and Ed25519 verification keys
- Encode/sign PLC operations with CBOR and multibase helpers
- Store DIDs, keys, and generic metadata locally
- Export keys in JSON, text, and environment-variable formats
Requirements
- PHP 8.0 or higher
- Composer
- Extensions:
curl,json
Installation
git clone https://github.com/fairpm/did-manager.git
cd did-manager
composer install
For WordPress package metadata parsing, install fairpm/did-manager-wordpress alongside this package.
Quick Start
<?php require_once 'vendor/autoload.php'; use FAIR\DID\DIDManager; use FAIR\DID\PLC\PlcClient; use FAIR\DID\Storage\KeyStore; $store = new KeyStore(__DIR__ . '/keys.json'); $client = new PlcClient(); $manager = new DIDManager($store, $client); $result = $manager->create_did( handle: 'example-package', service_endpoint: 'https://example.com/did-endpoint', type: 'package', metadata: ['owner' => 'Example Org'], ); echo $result['did'] . PHP_EOL;
Namespaces
FAIR\DID\Cryptofor encoding, canonicalization, and DID helpersFAIR\DID\Keysfor key generation, decoding, and exportFAIR\DID\PLCfor PLC client and operation objectsFAIR\DID\Storagefor local key/DID persistenceFAIR\DIDfor high-level DID lifecycle orchestration
Examples
Core examples remain in examples:
01-generate-keys.php02-plc-operations.php03-key-storage.php04-export-keys.php05-generate-and-submit-did.php
WordPress examples were moved to the did-manager-wordpress package.
Testing
composer lint
composer analyze
composer test
Formatting can be applied with:
composer lint composer format
The project uses a custom PSR-12-derived PHPCS ruleset for coding standards, PHPStan for static analysis, and PHPUnit for tests.
Related Packages
fairpm/did-manager-wordpressfor WordPress header parsing, readme parsing, and FAIR metadata generation
Security
Never commit private keys or generated keystore files to version control.
License
GPL-3.0-or-later. See LICENSE.md for details.