Simple PHP wrapper to talk to Freja eID REST API for use both in test and production enviroment.
- Supports validation of the JWS but requires external library for that part (thanks to php-jws).
- Supports both directed and inferred authentication, for use with qr-code and app.
- Supports authentication and signature api but not the assertion service.
- Well behaved functions that do not throw (atleast not by design) but always return objects for simpler handling.
- Not developed, supported or endorsed by Verisec.
To setup your test enviroment, and then basic agreement (free!!) read this information Freja eID
require_once('freja.php');
$frejaAPI = new phpFreja('testCertificate.pfx','SuperSecretPassword',false);
$qrInfo = $frejaAPI->createAuthQRCode();
if ($qrInfo->success)
$imageUrl = $qrInfo->url;
$authResponse = $frejaAPI->initAuthentication('EMAIL','[email protected]');
if ($authResponse->success)
$authStatus = $frejaAPI->checkAuthRequest($authResponse->authRef);
$frejaAPI->cancelAuthentication($authResponse->authRef);
$signResponse = $frejaAPI->initSignatureRequest('EMAIL','[email protected]','Testsign','This is the agreement text');
if ($signResponse->success)
$signStatus = $frejaAPI->checkSignatureRequest($signResponse->signRef);
$frejaAPI->cancelSignatureRequest($authResponse->signRef);