identisure / client
PHP client for the Identisure REST API
Requires
- php: ^8.3
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- guzzlehttp/guzzle: ^7.8
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^11.0
Suggests
- guzzlehttp/guzzle: Default HTTP client (auto-discovered if installed)
Provides
None
Conflicts
None
Replaces
None
README
Identisure PHP Client
API client for the Identisure REST API.
Documentation: identisure.github.io/api-client-php
Requirements
PHP 8.3 or later, and a PSR-18 HTTP client (Guzzle is used automatically if installed).
Supported providers
- BankID SE: auth, sign, phone auth and sign, QR verify, age verification
- BankID NO: auth, backchannel auth, sign, age verification
- Freja eID: auth, backchannel auth, sign, backchannel sign, age verification
- MitID: auth, backchannel auth, sign, age verification
- FTN (Finnish Trust Network): auth, age verification
- Vipps MobilePay: auth, backchannel auth
- Documents: upload and download documents for signing
Installation
composer require identisure/client
A PSR-18 HTTP client is required. The client auto-discovers Guzzle if installed:
composer require guzzlehttp/guzzle
Alternatively, inject any PSR-18 client via the builder.
Usage
<?php use Identisure\Client\Environment; use Identisure\Client\IdentisureClientBuilder; use Identisure\Client\Models\BankIdSe\BankIdSeAuthRequest; use Identisure\Client\Models\BankIdSe\BankIdSeCompleted; use Identisure\Client\Models\BankIdSe\BankIdSeFailed; use Identisure\Client\Models\BankIdSe\BankIdSePending; $client = (new IdentisureClientBuilder('client_id', 'client_secret')) ->environment(Environment::Staging) ->build(); $session = $client->bankIdSe()->auth(new BankIdSeAuthRequest()); assert($session instanceof BankIdSePending); echo "Session ID: {$session->id}\n"; $result = $client->bankIdSe()->waitForAuth($session->id); if ($result instanceof BankIdSeCompleted) { echo "Authenticated: {$result->name} ({$result->ssn})\n"; } elseif ($result instanceof BankIdSeFailed) { echo "Failed: {$result->error}\n"; }
Verifying callbacks
Pass the raw request body exactly as received, before parsing it.
use Identisure\Client\CallbackSignature; $valid = CallbackSignature::verify($rawBody, $request->getHeaderLine('X-Signature-SHA256'), $hmacSecret);
Development
Prerequisites
- PHP 8.3+
- Composer
The tests use shared fixtures from a git submodule. Clone with
git clone --recurse-submodules, or run git submodule update --init in an
existing clone.
Build
composer install
Test
composer test
Check
composer check
Release
Set the version in src/Transport.php and commit. Then push a tag:
git tag v0.1.0 git push origin v0.1.0
The release workflow checks that the tag matches the version, runs CI and creates a GitHub release. Packagist picks up new tags on its own.
Other languages
C#, Dart, Go, TypeScript/JavaScript, Java/Kotlin, Python, Ruby, Rust, Swift