digitalcz / digisign
DigiSign PHP library - provides communication with https://api.digisign.org in PHP via PSR-18 HTTP Client
Requires
- php: ^8.0
- ext-json: *
- php-http/discovery: ^1.13
- php-http/multipart-stream-builder: ^1.1
- psr/http-client: ^1.0
- psr/http-message: ^1.0.1 || ^2.0
- psr/simple-cache: ^1.0 || ^3.0
Requires (Dev)
- digitalcz/coding-standard: ^0.2.0
- nyholm/nsa: ^1.2.1
- nyholm/psr7: ^1.3
- php-http/httplug: ^2.1
- php-http/mock-client: ^1.3
- phpstan/extension-installer: ^1.2.0
- phpstan/phpstan: ^1.9.3
- phpstan/phpstan-phpunit: ^1.3.2
- phpstan/phpstan-strict-rules: ^1.4.4
- phpunit/phpunit: ^9.5
- symfony/cache: ^6.0
- symfony/http-client: ^6.0
- symfony/var-dumper: ^6.0
Suggests
Provides
None
Conflicts
None
Replaces
None
- 2.x-dev
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.1
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- 1.x-dev
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- 0.x-dev
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-DGS-4364-hal-query-flags
- dev-feature/plan-features-limits
- dev-feature/tooling-upgrade
- dev-feature/add-agents-md
- dev-release
- dev-remove-billingprofile-endpoint
This package is auto-updated.
Last update: 2026-09-24 07:24:49 UTC
README
DigiSign PHP library - provides communication with https://api.digisign.org in PHP using PSR-18 HTTP Client, PSR-17 HTTP Factories and PSR-16 SimpleCache.
API documentation is here https://api.digisign.org/api/docs
Install
Via Composer
$ composer require digitalcz/digisign
Configuration
Example configuration in PHP
use DigitalCz\DigiSign\Auth\ApiKeyCredentials; use DigitalCz\DigiSign\DigiSign; // Via constructor options $dgs = new DigiSign([ 'access_key' => '...', 'secret_key' => '...' ]); // Or via methods $dgs = new DigiSign(); $dgs->setCredentials(new ApiKeyCredentials('...', '...'));
Available constructor options
access_key- string; ApiKey access keysecret_key- string; ApiKey secret keycredentials- DigitalCz\DigiSign\Auth\Credentials instanceclient- DigitalCz\DigiSign\DigiSignClient instance with your custom PSR17/18 objectshttp_client- Psr\Http\Client\ClientInterface instance of your custom PSR18 clientcache- Psr\SimpleCache\CacheInterface for caching Credentials Tokenssandbox- bool; whether to use sandbox or production APIapi_base- string; override the base API urlsignature_tolerance- int; The tolerance for webhook signature age validation (in seconds)
Available configuration methods
use DigitalCz\DigiSign\Auth\Token; use DigitalCz\DigiSign\Auth\TokenCredentials; use DigitalCz\DigiSign\DigiSign; use DigitalCz\DigiSign\DigiSignClient; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Psr16Cache; use Symfony\Component\HttpClient\Psr18Client; $dgs = new DigiSign(); // To set your own PSR-18 HTTP Client, if not provided Psr18ClientDiscovery is used $dgs->setClient(new DigiSignClient(new Psr18Client())); // If you already have the auth-token, i can use TokenCredentials $dgs->setCredentials(new TokenCredentials(new Token('...', 123))); // Cache will be used to store auth-token, so it can be reused in later requests $dgs->setCache(new Psr16Cache(new FilesystemAdapter())); // Use sandbox API (https://api.staging.digisign.org) $dgs->useSandbox(true); // Overwrite API base $dgs->setApiBase('https://example.com/api'); // Set maximum age of webhook request to one minute $dgs->setSignatureTolerance(60);
Example configuration in Symfony
services: DigitalCz\DigiSign\DigiSign: $options: # minimal config access_key: '%digisign.accessKey%' secret_key: '%digisign.secretKey%' # other options cache: '@psr16.cache' http_client: '@psr18.http_client' sandbox: true # use sandbox API
Usage
Create and send Envelope
$dgs = new DigitalCz\DigiSign\DigiSign(['access_key' => '...', 'secret_key' => '...']); $envelopes = $dgs->envelopes(); $envelope = $envelopes->create([ 'emailSubject' => 'Please sign', 'emailBody' => 'Hello James, please sign these documents.', 'senderName' => 'John Smith', 'senderEmail' => 'john.smith@example.com' ]); $recipient = $envelopes->recipients($envelope)->create([ 'role' => 'signer', 'name' => 'James Brown', 'email' => 'james42@example.com', 'mobile' => '+420775300500', ]); $stream = DigitalCz\DigiSign\Stream\FileStream::open('path/to/document.pdf'); $file = $dgs->files()->upload($stream); $document = $envelopes->documents($envelope)->create([ 'name' => 'Contract', 'file' => $file->self() ]); $tag = $envelopes->tags($envelope)->create([ 'type' => 'signature', 'document' => $document, 'recipient' => $recipient, 'page' => 1, 'xPosition' => 200, 'yPosition' => 340 ]); $envelopes->send($envelope->id());
See examples for more
List endpoint without _actions / _links
Every resource returned by the API carries HAL metadata: _actions (operations the caller may perform on it)
and _links. Generating _actions is the expensive part of the API response — it evaluates business rules
and permissions for every returned item. When your integration does not read them (exports, synchronisation,
counting), turn them off with the $actions / $links arguments of list():
// list without _actions and _links — fastest variant for large pages $list = $dgs->envelopes()->list(['itemsPerPage' => 100, 'status' => 'completed'], actions: false, links: false);
Both arguments default to true, so existing calls keep the full response. Older API versions ignore the parameters.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer csfix # fix codestyle $ composer checks # run all checks # or separately $ composer tests # run phpunit $ composer phpstan # run phpstan $ composer cs # run codesniffer
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email devs@digital.cz instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.