kgilden / php-digidoc
A library for signing & verifying documents using estonian id card
Installs: 3 898
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 4
Forks: 7
Open Issues: 1
pkg:composer/kgilden/php-digidoc
Requires
- php: >=5.3.8
- ext-soap: *
- ext-zip: *
- doctrine/collections: ~1.0
- symfony/http-foundation: ~2.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-10-21 22:56:11 UTC
README
PHP DigiDoc is a PHP library for digitally signing and verifying digital
signatures using estonian id cards.
Usage
<?php use KG\DigiDoc\Api; use KG\DigiDoc\Client; // This file is generated by Composer require_once 'vendor/autoload.php'; $api = new Api(new Client()); // First off, let's create a new envelope. $envelope = $api->create(); // Add the files you want to get signed. $envelope->addFile('/path/to/file.txt'); $envelope->addFile('/second/path/to/file.md'); // Add a signature or two. Signature takes in certificate id and certificate // signature. You must retrieve these from the client using the browser plugin. $envelope->addSignature($signature = new Signature('F1..20', '8F..C0')); // Sync up with the server. For example, the previous signature is given // a challenge, which the client must solve. $api->update($envelope); printf("Challenge: %s\n", $signature->getChallenge()); // Set the solution for the given signature. This is computed by the borwser // plugin. $signature->setSolution('F6..00'); // Sync up with the server once more to send the solution. $api->update($envelope); // Time to write it on the disc. $api->write('/tmp/my-newly-created-envelope.bdoc'); // Make sure to "close" the envelope (basically closes the session in the // remote DigiDoc service). $api->close($envelope);
Installation
Install using Composer as kgilden/php-digidoc.
Requirements
- PHP >= 5.3.8
- (php-soap, if you're on a Debian based distro)
Contributing
See CONTRIBUTING.md file.
Running the Tests
It's as simple as running phpunit.
License
PHP DigiDoc is released under the MIT License.
See the bundled LICENSE file for details.