PHP code example of hajarrashidi / bankid

1. Go to this page and download the library: Download hajarrashidi/bankid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hajarrashidi / bankid example snippets



// If you don't have Composer autoload
 new Bankid_6_0_dev([
    'verify' => false,
    'headers' => [
        'Content-Type' => 'application/json',
    ],
    'cert' => __DIR__ . '/bankid_test_cert.pem'
]);

$response = $bankid->auth([ 'endUserIp' => "127.0.0.1" ]);
//$response = $bankid->sign([ 'endUserIp' => "127.0.0.1", 'userVisibleData' => base64_encode("hello") ]);
//$response = $bankid->phoneSign([ 'personalNumber' => "111122334444", "userVisibleData" => base64_encode("hello"), "callInitiator" => "user"]);
//$response = $bankid->phoneAuth([ 'personalNumber' => "111122334444", "callInitiator" => "user"]);

var_dump($response);