PHPackages                             dencel/eparaksts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dencel/eparaksts

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dencel/eparaksts
================

PHP client library for the eParaksts e-signature and identity platform

0.3.1(3w ago)0611MITPHPPHP &gt;=8.4CI passing

Since Feb 7Pushed 3w agoCompare

[ Source](https://github.com/denissceluiko/eparaksts)[ Packagist](https://packagist.org/packages/dencel/eparaksts)[ RSS](/packages/dencel-eparaksts/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (8)Versions (13)Used By (1)

dencel/eparaksts
================

[](#denceleparaksts)

PHP 8.4+ client library for the [eParaksts](https://www.eparaksts.lv/) Latvian e-signature and identity platform.

Installation
------------

[](#installation)

```
composer require dencel/eparaksts
```

Two APIs
--------

[](#two-apis)

The library covers two distinct eParaksts services:

ClassHostPurpose`Eparaksts``eidas.eparaksts.lv`OAuth2 identity &amp; remote signing`SignAPI``signapi.eparaksts.lv`Document session signing---

Eparaksts — Identity &amp; OAuth2
---------------------------------

[](#eparaksts--identity--oauth2)

### Authorization code flow (web login)

[](#authorization-code-flow-web-login)

```
use Dencel\Eparaksts\Eparaksts;

$e = new Eparaksts('client-id', 'client-secret');

// 1. Redirect the user
$url = $e->authorize(Eparaksts::SCOPE_IDENTIFICATION, 'random-state', 'https://app.test/callback');
header('Location: ' . $url);

// 2. Handle the callback
$token = $e->requestToken(Eparaksts::GRANT_AUTHORIZATION_CODE, [
    'code'         => $_GET['code'],
    'redirect_uri' => 'https://app.test/callback',
]);

// 3. Fetch the authenticated user
$user = $e->me(Eparaksts::SCOPE_IDENTIFICATION);
```

### Client credentials flow (server-to-server)

[](#client-credentials-flow-server-to-server)

```
$token = $e->requestToken(Eparaksts::GRANT_CLIENT_CREDENTIALS, [
    'scope' => Eparaksts::SCOPE_SIGNATURE,
]);
```

### Scopes

[](#scopes)

ConstantValue`SCOPE_IDENTIFICATION``openid profile``SCOPE_SIGNATURE``openid sign``SCOPE_IDENTIFICATION_WITH_AGE_14/16/18/21`age-gated identification### Remote signing

[](#remote-signing)

```
// Get available identities for the authenticated user
$identities = $e->getSignIdentity(Eparaksts::SCOPE_SIGNATURE);

// Pick the signing certificate
$identity = $e->findIdentity(Eparaksts::CERT_MOBILEID_SIGN, $identities);
$cert     = $e->findCert(Eparaksts::CERT_MOBILEID_SIGN, $identities);

// Sign a digest
$signature = $e->sign($digest, 'rsa-sha256', $identity['id']);

// Batch sign multiple digests
$signatures = $e->signBatch([
    ['digest_value' => $digest1, 'document_name' => 'doc1.pdf'],
    ['digest_value' => $digest2, 'document_name' => 'doc2.pdf'],
], 'rsa-sha256', $identity['id']);
```

Certificate type constants: `CERT_MOBILEID_AUTH`, `CERT_MOBILEID_SIGN`, `CERT_SIGNING`, `CERT_QSEAL`.

### Session persistence

[](#session-persistence)

`Eparaksts` implements `__serialize`/`__unserialize` so it can be stored in the PHP session:

```
$_SESSION['eparaksts'] = serialize($e);
$e = unserialize($_SESSION['eparaksts']);
```

### Logout

[](#logout)

```
$url = $e->logout('https://app.test/');
header('Location: ' . $url);
```

---

SignAPI — Document signing sessions
-----------------------------------

[](#signapi--document-signing-sessions)

```
use Dencel\Eparaksts\SignAPI\v1\SignAPI;

$api = new SignAPI('client-id', 'client-secret');
$api->freshToken(); // fetches and stores a client_credentials token
```

### Signing flow

[](#signing-flow)

```
// 1. Create a session
$session = $api->session()->start();
$sessionId = $session['sessionId'];

// 2. Upload document
$file = $api->storage()->upload($sessionId, '/path/to/doc.pdf');

// 3. Compute digest (pass auth certificate from Eparaksts::findCert())
$digest = $api->signing()->calculateDigest($sessionId, $authCert);

// 4. Sign the digest remotely (using Eparaksts client)
$signature = $eparaksts->sign($digest['digests'][0]['digest'], 'rsa-sha256', $identityId);

// 5. Finalize
$api->signing()->finalizeSigning($authCert, $sessionId, $signature);

// 6. Download signed document
$response = $api->storage()->download($sessionId, $file['fileId']);
// For .edoc documents only — download as ASiC-E container:
$response = $api->storage()->download($sessionId, $file['fileId'], asice: true);

// 7. Close session
$api->session()->close($sessionId);
```

### eSeal (server-side signing)

[](#eseal-server-side-signing)

```
$keyData = $api->configuration()->publicKey();

$encryptedPassword = $api->signing()->encryptSignKeyPassword('pfx-password');

$api->signing()->eSealCreate(
    sessions: $sessionId,
    authCertificate: $authCert,
    signKey: base64_encode(file_get_contents('seal.pfx')),
    signKeyPassword: $encryptedPassword,
);
```

### Batch signing (multiple sessions)

[](#batch-signing-multiple-sessions)

```
$digest = $api->signing()->calculateDigest(['session-1', 'session-2'], $authCert);

$api->signing()->finalizeSigning($authCert, [
    ['sessionId' => 'session-1', 'signatureValue' => $sig1],
    ['sessionId' => 'session-2', 'signatureValue' => $sig2],
]);
```

### Other services

[](#other-services)

```
// Sharing
$api->share()->start($sessionId, ['123456-12345']);
$api->share()->delete($sessionId);

// Validation
$api->validation()->validate($sessionId);

// Configuration
$maxFileSize = $api->configuration()->get('maxFileSize');
```

---

Debugging
---------

[](#debugging)

Inject a Guzzle `HandlerStack` with a history middleware to inspect all HTTP traffic:

```
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;

$container = [];
$stack     = HandlerStack::create();
$stack->push(Middleware::history($container));

$e   = new Eparaksts('client', 'secret', handlerStack: $stack);
$api = new SignAPI('client', 'secret', handlerStack: $stack);

// After requests:
foreach ($container as $tx) {
    echo $tx['request']->getMethod() . ' ' . $tx['request']->getUri() . PHP_EOL;
}
```

---

Requirements
------------

[](#requirements)

- PHP 8.4+
- `ext-fileinfo`, `ext-openssl`

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

43

↑

FairBetter than 89% of packages

Maintenance94

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~28 days

Total

12

Last Release

27d ago

PHP version history (2 changes)0.1PHP &gt;=8.2

0.3.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1970126?v=4)[Dencel](/maintainers/Dencel)[@Dencel](https://github.com/Dencel)

---

Top Contributors

[![denissceluiko](https://avatars.githubusercontent.com/u/12938632?v=4)](https://github.com/denissceluiko "denissceluiko (17 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dencel-eparaksts/health.svg)

```
[![Health](https://phpackages.com/badges/dencel-eparaksts/health.svg)](https://phpackages.com/packages/dencel-eparaksts)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[oat-sa/tao-core

TAO core extension

66143.7k122](/packages/oat-sa-tao-core)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346132.9M112](/packages/google-cloud-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[google/cloud

Google Cloud Client Library

1.2k16.7M57](/packages/google-cloud)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
